A security guard has been injured by a car which crashed into the front of the US consulate in Shanghai, Chinese state media report.

The car was travelling along South Urumqi Road in the city when it veered into the building's guardrail late on Thursday, said the Xinhua news agency.

The cause of the crash is not immediately known, but officials said the driver, from Fujian province, appeared to be in a confused state.

The 35-year-old driver was arrested.

In a statement to police, he said he had driven from Hangzhou to Shanghai, about 170km (105 miles).

"I saw the place is guarded by armed police. So I crashed my car into it," he said.

His wife told police he had been unwell and suffering hallucinations for several months.

Images in the media showed that the car, a black Toyota, had mounted the pavement and ended up close to the guard's sentry box at the entrance.

The Chinese guard was slightly injured but recovering, said officials.

A US consulate spokesman told AFP news agency that all staff had been accounted for and the building was expected to operate as usual on Friday.