Allegheny Township police have accused a township resident of offering to purchase a 6-year-old girl from her mother.

Theodore Magee, 43, offered to purchase the girl who, authorities say, he had sexually assaulted, according to a criminal complaint filed against him.

Magee is charged with a half-dozen felonies, including aggravated indecent assault of a child, attempted indecent assault of a child and trafficking in individuals.

While Magee watched the girl overnight last March, police said, he touched her inappropriately.

In an interview with police, Magee said he and the girl — whom he referred to as his “girlfriend” in videos and messages — had slept on the same air mattress and “hugged,” according to the complaint.

When police searched Magee’s phone, they discovered a message to the girl’s mother offering to buy her for $5,000, the complaint said. A search of the phone also revealed photographs and videos of the girl, police said.

Magee’s preliminary hearing is set for Jan. 20 before District Judge Cheryl J. Peck-Yakopec.