A teenage girl outwitted an ill-intentioned Uber driver thanks to her text messages from his car and a cellphone photo that alerted West St. Paul police to her peril.

The officer arrived in time to thwart a likely rape by a man with a “large amount” of condoms, according to the criminal complaint filed Wednesday in Dakota County District Court.

Dahir A. Aden, 50, appeared in court on a charge of false imprisonment. Aden remains free pending a November court appearance. A man who answered the phone at his home Thursday declined to comment about the case.

According to the criminal complaint:

The 17-year-old said that on Aug. 4 the Uber driver picked her up at her north Minneapolis home and later stopped to pick up a friend of hers who was driven to his job in south Minneapolis. The girl wanted to be returned home, but the driver refused.

She saw the driver was on a highway and asked where they were going. Aden said they were heading to his apartment for sex. The girl demanded Aden take her home, but he refused and kept heading toward his residence in West St. Paul.

As they drew closer to the driver’s apartment, the girl sent messages to a friend that she needed the police.

When Aden and girl arrived outside the apartment complex, he repeatedly told her, “Go inside, go inside to have quick sex.” The girl said no and exited the car.

While Aden was trying to grab the girl’s phone, she called her friend and said to come get her. She told her friend the driver wanted her to come inside and have sex. The friend pleaded with her to not go in the apartment and that he was calling police.

Not knowing where she was, the girl photographed the car and the address, and sent that to her friend.

An officer arrived, and Aden said the girl was his girlfriend but then said she wasn’t. He also had difficulty explaining why he was in West St. Paul, when the girl wanted to go Minneapolis. The officer “located a large amount of condoms on Aden’s person,” the complaint read.

Court records for Aden show offenses in Minnesota no more serious than parking and minor traffic violations.