NEW BEDFORD, Mass. — A police officer who was attempting to execute a search warrant at a New Bedford apartment was wounded after someone opened fire on officers from inside the barricaded home, police said Saturday.

Authorities said the officer’s injuries were not life-threatening. He was first taken for treatment at St. Luke’s Hospital in New Bedford before being transferred to Rhode Island Hospital.

New Bedford police said members of its Organized Crime and Intelligence Bureau were executing a search warrant at a Davis Street apartment late Friday. The officers were trying to storm through a door barricaded with a security bar when someone opened fire several times from inside the home, hitting one officer.

“The officers retreated and took positions of cover while calling for back up,” police said in a statement. “After a short stand off the people inside the apartment stated that they would open the door and remove the security bar.”

Police took five people into custody, including three Boston residents and a man from Trussville, Ala.

Two suspects were eventually arrested and charged. Apartment resident Nathan Manuel-Jackson, 20, was charged with armed assault with intent to murder, assault and battery with a deadly weapon and other firearm violations. The second suspect, Thomas Scott, 34, of Boston’s Mattapan neighborhood, faces charges of being an accessory after the fact and several firearm violations. It was not immediately clear if the two men have attorneys.

Three people were served with grand jury subpoenas and might be charged in the future, police said.

Spokeswoman Elizabeth Treadup Pio said New Bedford Mayor Jon Mitchell had no immediate comment on the shooting.