A cyclist who allegedly tried to steal a cell phone through the open window of a car was arrested Wednesday night, after he lost his balance and wrecked during the crime.

It all went down, police say, on the 1400 block of Valencia Street, which is between 25th and 26th Streets.

According to the San Francisco Police Department, a 30-year-old man was a passenger in a car headed down Valencia at 11:14 Wednesday night.

Suddenly, a 22-year-old man appeared, riding a bicycle next to the vehicle. According to the SFPD, the man reached into the car's open window in an alleged attempt to steal the passenger's cell phone.

A struggle over the phone ensued, police say, and the criminal cyclist lost his balance and crashed.

The suspect was not injured in the wreck, according to the SFPD, but was stunned long enough for police to arrive and take him into custody for the attempted theft.