A man who allegedly escaped from Auckland District Court on Tuesday was found trapped under a house in Manurewa.
Police had been searching for the 48-year-old since he allegedly escaped earlier in the week.
Detective Senior Sergeant Lloyd Schmid said police pulled over a vehicle about 12.15pm and the man ran from the car.
Police chased and cornered him but had to use pepper spray and a taser in an attempt to arrest him.
It was then he allegedly pulled a pistol on the officer, forcing them to retreat.
The Armed Offenders Squad was called and he was soon recaptured hiding under a house in nearby McKean Ave, Manurewa.
Senior Sergeant Emiel Logan said a member of the public informed a police dog handler of a man trapped under a house making some noise.
"Staff have gone to investigate that and found a person calling out that he was trapped under the house."
Police earlier said the man was considered dangerous and should not be approached.
A police spokesperson said the area in South Auckland had been cordoned off as police went to investigate what has occurred.
Pedestrians were asked to keep clear of the area and motorists are encouraged to use alternative routes.
Nearby resident Rohit Sharma said it looked serious.
"There's about four police cars down one end and guys with guns who are obviously the AOS. Then more cop cars down the other end and helicopters circling above the area."
Sharma said emergency crews had been there for at least two hours.
The man will be appearing in Auckland District Court tomorrow charged with escaping custody, and presenting a firearm at law enforcement officers.