A Las Vegas man was arrested Monday after an attempted kidnapping of a 16-year-old girl whom he had limited contact with on an online app.

Benjamin J. Margitza, 18, was apprehended outside a northern Kentucky high school and charged with attempted kidnapping of a minor and criminal trespassing.

Margitza had briefly been in contact with the girl four years ago through the app. Despite limited contact, he reportedly made frequent attempts to reconnect with her and then began sending sexually explicit messages and telling her he wanted them to be married.

After flying from Las Vegas, Margitza located the girl at her school and attempted to grab her in the school’s parking lot. A male student would intervene, allowing the girl to get away and report the incident to a School Resource Officer, who then located Margitza in the back of an Uber before police could arrive.

Margitza was then taken into custody by the Boone County Sheriff’s Office.

The Cincinnati Enquirer reported that Margitza had told detectives that he would have followed the teen into the school had the male student not stepped in and that he intended to convince the teenage girl to have sex with him at his hotel.

In this representative photo, police cruisers respond as demonstrators march in protest outside the Ferguson Police Department in Ferguson, Missouri, Nov. 26, 2014. Michael B. Thomas/AFP/Getty Images