A school official who confiscated a 17-year-old girl's phone in school thwarted a man's scheme to pay her for sex after the two talked in an online chat room and then exchanged steamy text messages, according to a criminal complaint.

Mark Jerome Anderson, 52, of Champlin, was charged Monday in Hennepin County District Court with a felony prostitution charge involving a minor. Anderson was arrested Friday and was released after posting bond.

According to the criminal complaint:

The girl said she began communicating with Anderson in a chat room, then they starting texting each other on Oct. 9 about sex. They discussed meeting and Anderson paying the girl for sex.

The two then arranged for him to pick her up at school the next day, with him texting that they didn't have to have sex but "will still give u some cash???"

Anderson texted that he was "here now" as planned, but a school official had taken the girl's phone because of her texting, preventing the two from meeting. Authorities did not disclose the location of the school.

A week later, the girl's father told Dayton police that she had been "sexting" with an older man, who police determined to be Anderson.

In an e-mail Tuesday, the Hennepin County Sheriff's Office said the case was "another reminder about the potential dangers of using social media." The office warned teens to never share personal information or passwords online. Teenagers should not meet face-to-face with people they meet online. Also, they should talk to their parents about what they do online.