A veteran Minneapolis South High School teacher tried to have sex with a 17-year-old student a few weeks before the end of the school year, authorities said Wednesday.

Social studies teacher Dan Arlen Anderson, 46, of Oakdale, is charged with third-degree attempted criminal sexual conduct with someone under his authority as a teacher as well as stalking. Anderson has been licensed as a Minnesota teacher since 1997, and earlier taught at Webster Open school.

The complaint filed by the Hennepin County attorney's office said Anderson pressed the girl to have sex with him starting on May 15, but she put him off. He later allegedly sent text messages asking her to come to his room after school to "mess around," and later to sneak out of her house at night to meet him, and also to do "dirty texting."

The girl told her parents, who told her to ask Anderson to text her a photo. He responded by twice texting a photo of his genitals, the complaint said. He is alleged to have sent a dozen text messages to her.

The complaint also alleged that police found several incriminating text messages on Anderson's phone.

Anderson no longer works for the school district, according to Stan Alleyne, chief communications officer for Minneapolis public schools.

"We have been working closely with police throughout the investigation," Alleyne said in a written statement. "MPS responded appropriately and followed proper protocols."

Anderson's next hearing is scheduled for July 31.

Steve Brandt • 612-673-4438

Twitter: @brandtstrib