A man pulled a gun and fired a volley of shots at police officers after he was stopped by a routine patrol.
Scotland Yard said the man fired 10 times as he was being chased through the streets near King's Cross station in central London on Monday afternoon.
At one stage he tried to hijack a black taxi by pointing the gun in the driver's face.
No-one was injured and two men have been arrested.
The drama began when a routine patrol stopped a suspected stolen Mercedes car in the Camden area of north London at 1550 GMT.
The driver and a passenger were told to get out but as they did so one of the men pushed past the officers and ran off.
The officers gave chase but retreated when the man turned and fired about 10 shots.
No injuries
He then tried to hijack a passing cab by pointing the gun through the driver's window but the driver managed to escape.
More police then arrived on the scene and one of them approached the armed man and told him to drop his weapon.
The gunman pointed his gun at the officer and then at the driver of one of the police vehicles before being overcome by a number of officers.
Scotland Yard said none of the officers were armed.
Police are appealing for witnesses to come forward, in particular the cab driver who was threatened by the gunman.