A federal judge on Thursday sentenced a former D.C. police officer to seven years in prison for prostituting teenage girls, saying she initially thought the punishment too lenient but now views it as appropriate.

U.S. District Judge Rosemary M. Collyer refused to agree to the defendant’s personal plea to be supervised for five years upon his release and ordered it to be 10 years. Linwood Barnhill Jr. also will be registered as a sex offender.

“You have served this community so well,” Collyer told the 48-year-old Barnhill, who resigned from 24 years on the police force when he pleaded guilty in June. “It is sad for me to have to sentence you today. I hope you recover.”

The judge said that Barnhill exploited vulnerable teens — two were chronic runaways — and that as a police officer, society expected him to protect them. “I think the nature of this crime is quite serious,” Collyer said. “I somewhat reluctantly accept the 84 months the parties have recommended.”

Later, the judge said: “The victims have had hard lives. They deserve our sympathy and our respect.”

Barnhill, whose attorney said he suffered from debilitating depression that caused him to take long leaves of absences from work, pleaded guilty to two counts of pandering minors for prostitution and one count of child pornography. His attorney noted that he received numerous commendations for police work. He spoke briefly during the hearing, but his comments were inaudible to the gallery.

Barnhill’s arrest in December came after parents of a missing 16-year-old girl traced her to his apartment in Southeast Washington. Police found the teen, along with a 15-year-old. A 17-year-old girl was later linked to the case. The girls told police that Barnhill lured them by offering modeling jobs, bought them clothes, took pictures of them in stages of undress and then set them up with men for sex in return for $80. One girl said she went through with one meeting; the other did not. A third had pictures taken.

Assistant U.S. Attorney Ari B. Redbord and Barnhill’s attorney, Joanne D. Slaight, said the victims were adamant that they did not want to be involved in a trial and are trying to move on with their lives. They also said the former officer “is not a pedophile” — that he thought the victims were at least 18 and that he did not coerce them, force them to participate in sexual acts or distribute the pictures he took of them.

Redbord and Slaight agreed that Barnhill did not assert his police authority with the teens. Both said none of the victims knew that Barnhill worked in law enforcement.

The judge said that was important because it meant he did not commit illegal acts under what is called the “color of law.”

“He didn’t rely on his powers as a police officer in any way to carry out his criminal acts,” the judge said. That and the reluctance of the victims to be involved in a trial persuaded her to accept the deal.

But William C. Johnson Jr., an attorney for the mother of the 16-year-old victim, disputed that assertion.

He told reporters that his client said Barnhill “brandished a weapon and bragged about being a police officer” when the two first met. The teen recalls that Barnhill’s apartment was strewn with police items, such as uniforms and badges, and that other D.C. officers visited but that she did not see them commit any illegal acts, according to Johnson.

Johnson, who attended Thursday’s hearing, said he did not speak up in court because his client wanted the judge to accept the agreement to ensure that Barnhill went to prison. He said the teen does not want to testify because she and her mother fear police retribution.

Slaight said Johnson’s comments were the first she had heard of the allegation, and she disputed the claim.

Bill Miller, a spokesman for the U.S. attorney’s office, said the plea followed an extensive investigation by prosecutors and police, “including multiple interviews with all three victims. . . . We have no evidence that Mr. Barnhill acted under the color of law, and we stand by our sentencing memorandum and statements made to the court.”