An Oakland, California, police officer was shot Wednesday morning after responding to reports of a man armed with a firearm, authorities said. 

The suspect was later arrested after barricading himself inside a building, while the wounded officer was transported to a hospital in stable condition, the Oakland Police Department said. 

The officer was "doing well," police Chief LeRonne Armstrong said during a news conference.

"This is a difficult day for us," Armstrong added, "but a day that we are very fortunate because the officer is currently being treated for non-life-threatening injuries."

SUSPECTS IN KRISTIN SMART'S 1996 DISAPPEARANCE TO STAND TRIAL

A caller alerted the department around 6:30 a.m. that a man with a gun was seen less than a mile north of downtown Oakland, according to authorities. 

The suspect, who has yet to be identified, immediately fired shots at the officers after they arrived at the 2100 block of Telegraph Avenue, police said.

The wounded officer and a second officer returned fire, hitting the suspect, police said, according to FOX 2 of the Bay Area.

The suspect then ran inside the lobby of a nearby apartment building, authorities said. Now armed with a knife, he barricaded himself inside the lobby as officers established a perimeter outside the building.

Authorities are seen in Oakland, Calif., on Wednesday. Police said one officer was shot by a suspect who later barricaded themselves in a building. (KTVU)

The suspect, described by Armstrong as a man in his 50s, started to stab and cut himself, according to police. He stayed in the building for about two hours until police negotiators and a mental health team got him to surrender.

RETIRED LA SHERIFF'S DETECTIVE FOUND DEAD IN FREEZER, INVESTIGATION UNDERWAY

Residents were asked to shelter in place during the armed standoff, authorities said. Officers later recovered the knife and discarded firearm allegedly used by the suspect, police added.

Armstrong credited the mental health team for playing an "important role" in negotiating with the suspect, who was being treated for non-life-threatening injuries, police said. 

An investigation was underway to determine if the suspect was homeless and lived in a nearby encampment, FOX 2 reported. 

CLICK HERE TO GET THE FOX NEWS APP

On Monday, Oakland, a city of 425,000 people, recorded its 100th homicide of the year. There were 109 homicides recorded there in the entirety of 2020, according to the Associated Press. 

"This is a sober reminder of how dangerous it is in the city of Oakland," Armstrong said. "The level of violence in this city continues to be intolerable."