When talking with police, the 38-year-old suspect first claimed that he "had some hallucination," but then admitted that he stole the bike.

Huangpu police

Huangpu police

A foreigner has been detained for allegedly stealing an e-bike in a downtown residential complex, Shanghai police said on Friday.

The suspect was caught red-handed after the owner of the e-bike was alarmed about the theft via an app on his mobile phone.

When talking with police, the man first claimed that he “had some hallucination," but then admitted stealing the bike when confronted with evidence, according to police.

The suspect is 38 years old, but police declined to reveal his nationality.

The theft took place at about 6pm on April 26 in Huangpu District.

The owner of the e-bike, a man surnamed Tan, said he was notified by an alarm on his phone while he was cooking at home and immediately rushed downstairs to check on his bike.

Tan said he suspected theft because he forgot to lock up his bike, an expensive model which costs about 6,000 yuan (US$950).

He said he saw a foreign man slowly riding away on his e-bike and stopped him.

The foreigner claimed that the bike was his, but didn’t have a key or invoice of purchase, Tan said.

The suspect was kept on the scene by security guards of the residential complex until police from Nanjing Road E. Police Station arrived and took him away for questioning.

Footage from surveillance cameras in the residential complex showed that the suspect entered at about 5pm and started scoping out the area's e-bikes, before finally making off with Tan’s bike, police said.