Two Prince George's County police officers were shot while trying to serve a warrant Wednesday night, officials said.

A special operations unit was executing a drug search warrant at an apartment building on Lorring Drive in District Heights Wednesday when the shooting happened, police said.

The tactical team knocked on the door in question and then opened it after no response at which time a person inside the apartment fired a shotgun, hitting two officers, police said.

"We could be talking about a completely different situation based on what they encountered when they got into that apartment, so we are very, very relieved tonight that both of our officers are alive," Prince George's County police spokeswoman Jennifer Donelan said.

One of the officers was hit in the hand, and the other in the shoulder, police said. An officer fired back at the suspect, but did not hit them, police said.

The suspect surrendered to police after the shooting, officials said. A second person in the apartment was taken into custody as a witness, police said.

The two injured police officers were flown to Shock Trauma Center. One officer is in serious condition and the other is listed in stable condition, police said. Both officers are expected to survive.