Police surrounded flats in east London when a man barricaded himself in and threatened to blow up the block.
Nearby residents in Barking were forced to leave their homes after the man also threatened to burn down the building.
Fire and ambulance crews were called to Elsdown House, Wheelers Cross, late on Tuesday, although there were no injuries reported.
A man was later detained and was given medical treatment by paramedics at the scene, the Met Police said.
Evacuated residents, who had been told to go to The Gascoigne Community Centre, in St Ann’s, were later told they could return home.