Detained before the Lord - Probably fulfilling some vow to the Lord, and therefore for a time resident at the tabernacle.
And his name was Doeg - From 1 Samuel 22:9; we learn that this man betrayed David's secret to Saul, which caused him to destroy the city, and slay eighty-five priests. We learn from its title that the fifty-second Psalm was made on this occasion; but titles are not to be implicitly trusted.
Detained before the Lord - Either to fulfill a vow Acts 21:23-27, or on account of uncleanness, or under the law of lepers Leviticus 13:4, Leviticus 13:11, Leviticus 13:21, or as a proselyte. It is not impossible that Doeg may have been in custody or in sanctuary for some crime.