MANHATTAN – An armed man surrendered to police after pacing in front of the United Nations for hours, prompting a large NYPD response and massive traffic delays in Midtown, video of the scene Thursday showed.

Police vehicles and officers descended on the streets surrounding East 42nd Street and First Avenue, outside the UN. The situation was first reported around 11 a.m.

During the hourslong ordeal, the man donning a red sweater was seen acting erratically, pacing in front of the building where a row of national flags are visible, and holding the gun to his chest as he pointed the barrel up toward his head.

The man put down the gun and threw his hands up in surrender around 1:45 p.m., video showed.

Police then escorted the man away, and NYPD press officials tweeted that there was no longer any threat to the public.

During the standoff, UN staff were told to shelter in place, according to a journalist who works for the United Nations.