Updated

Police in New Hampshire caught the suspect accused of shooting and wounding two officers Friday in Manchester after a manhunt that stretched for hours.

Ian McPherson, 32, faced two counts of attempted capital murder, Associate Attorney General Jane Young told reporters. Officers had called the wanted suspect "extremely dangerous."

Officer Ryan Hardy, 27, had stopped McPherson early Friday after suspecting he was involved in a gas station robbery a day earlier, Police Chief Nick Willard said. The suspect allegedly fired at the officer, hitting him once in the face and once in the shoulder before escaping.

Two additional officers spotted McPherson less than a half-hour later. The suspect shouted "I'm your man" and fired, hitting 28-year-old Officer Matthew O'Connor in the leg, Willard said.

Hardy was recovering in stable condition at a hospital in Boston near his family. Doctors released O'Connor earlier in the day.

Details of the suspect's capture were unclear. Police said they took him into custody around 5 a.m., but did not lift shelter-in-place orders until later in the morning when they could be sure the public was safe.

Police say Hardy is married with two children. O'Connor, also married, served a tour of duty in Afghanistan before joining Manchester Police.

Willard said Hardy had an strong will to survive. "He permeates that attitude."

Floyd Johnson lives near one of the shooting sites on Manchester's west side. He said he awoke to the sound of multiple gunshots at about 2:15 a.m. Seconds later, "all the police swarmed in," Johnson said.

He said he told his 13-year-old son to get on the floor. Police also told Johnson to stay put, away from the windows.

Johnson said he's lived on the west side all his life, and he's never seen anything like this before.

West High School, Gossler Park School, Northwest Elementary School, Parker-Varney School and Parkside Middle School all closed Friday during the search.

New Hampshire Governor Maggie Hassan thanked the officers for their "bravery and service."

The Associated Press contributed to this report.

Click for more from Fox 25 Boston.