William Whitley acknowledged Tuesday he paid young girls for sex.

The longtime veteran of the Chicago Police Department admitted he would order them up before he’d go to work — leaving his uniform hanging on the bedroom door and his gun under his pillow while they were in bed.

But even as he prepared to admit his guilt to a federal judge Tuesday, Whitley insisted that braces on the teeth of one young girl “don’t dictate a person’s age.” He still thought she was older.

U.S. District Judge Virginia Kendall nevertheless accepted Whitley’s guilty plea to one count of sex trafficking of a minor. He now faces a minimum of 10 years in prison but could be looking at a lifetime behind bars. His sentencing is set for Sept. 4.

CPD has previously said Whitley was stripped of his powers in September 2015. He must register within days as a sex offender. Court personnel said his current residence is problematic, but Kendall gave him until Friday to find a new place to live.

A grand jury accused Whitley last year of trafficking four teenage girls for sex, as well as producing child pornography. That followed a 2015 FBI investigation that authorities said led them to Whitley.

When confronted, Whitley acknowledged he saw braces on the teeth of a 14-year-old girl he paid for sex, according to the criminal complaint that led to his arrest. But he said he did not know her age. She apparently told him she was 23.

That same girl was arrested in a September 2015, but she told authorities about her “johns,” including Whitley, according to the complaint. She said she was introduced to him in June 2015 and had sex with him about five times, collecting between $60 and $150 from him each time.

She said he also wore a gold chain with the CPD logo on it. And at times, she said, he bragged about being a cop.

The feds said Whitley was in touch with the girl by phone “hundreds of times” between July 24, 2015 and Sept. 17, 2015. Once, after he began texting the girl, she replied, “Awww ok wassup then.” And he replied, “You already know” and added, “B4 I gotta work.”

The girl also said Whitley took naked photographs of her inside his apartment.

The 14-year-old girl led authorities to a 16-year-old girl who also said she had sex with Whitley for money. She said Whitley pulled up next to her and a friend once in Englewood and asked if they wanted to take a ride with him and “his partner.” They agreed, though the girl said she suspected Whitley might be a cop based on the way he spoke.

The 16-year-old girl said Whitley was in the driver’s seat, and the partner was in the passenger seat. That’s when she said Whitley gave her $65 “in exchange for giving him oral sex.” She said she had oral sex with Whitley five times, each time collecting $60 to $65 from him.