A lone assailant has detonated what police described as merely a firework device outside the US embassy in Beijing today, primarily causing damage to himself.

The explosion happened on outside the embassy compound, Beijing police said the suspect, a 26-year-old man from China's Inner Mongolia region had injured his hand and had been taken to hospital.

Police did not provide a motive but said in a statement via their official account on the Chinese social networking service Weibo that the suspect had a history of mental illness and was once hospitalised for treatment.