MANCHESTER, N.H. (CBS/AP) – A suspect has been arrested after two police officers were shot early Friday morning in Manchester, New Hampshire.

Manchester Mayor Ted Gatsas confirmed at a Friday afternoon press conference that the suspect was in custody and “the city is safe” after a search took place throughout the morning.

Around 2 a.m. at Second and Ferry streets, Officer Ryan Hardy stopped a man who matched the description of an armed man who robbed a Shell gas station in the city the night before.

The suspect, identified as Ian MacPherson, allegedly shot at Hardy, hitting him once in the face and once in the shoulder. Hardy called for assistance after being shot.

During a subsequent search, officers located MacPherson in the area of Putnam and Dubuque streets around 2:30 a.m.

Police say MacPherson yelled “I’m your man” and shot again, striking Officer Matthew O’Connor in the leg.

Officers returned fire at MacPherson, who ran into a wooded area.

After searching for several hours, police located MacPherson and arrested him around 5 a.m.

MacPherson will face two counts of attempted capital murder for shooting at the officers.

O’Connor was treated at an area hospital and released.

Hardy was transferred to a Boston hospital in stable condition. He was transported due to personal preference in hospital, not because of his condition.

Thank you for your thoughts and prayers regarding our two officers. — Manchester NH Police (@mht_nh_police) May 13, 2016

Resident Bob McKenna said he was woken up in the middle of the night by 10-to-12 shots fired in his neighborhood.

“Within a minute there were 15 cruisers between Cartier and Dubuque. The street was covered,” he told WBZ-TV.

“Par for the course for the area, unfortunately,” he said. “This used to be a very nice neighborhood. It’s not so anymore.”

Several streets had been shut down and schools on the west side of the city were closed for the day because of the manhunt.

Police put in a “shelter in place” for the area around Wayne Street, Putnam Street and Rimmon Street before sunrise.

Officers were seen in the neighborhoods with their weapons drawn for several hours, but they started to leave the area around 9:30 a.m.

Helicopters overhead as police search for a man who shot two police officers early this morning in #Manchester NH. pic.twitter.com/PjlQAnCjRl — Carl Stevens (@carlwbz) May 13, 2016

Schools on the west side of the city were shut down for day because of the search, including Gossler Park, Northwest, Parker Varney, Middle at Park Side and West High.

MacPherson is scheduled to be arraigned Monday in 9th Circuit District Court, Manchester Division.

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)