Three police officers were shot Sunday while responding to a call in Prince George’s County, officials said. Two people were taken into custody.

The officers are “going to be fine” after being taken to a hospital, interim county police chief Hector Velez said Sunday night. They suffered “various degrees of injuries,” he said, but “are in good spirits.”

The officers were responding to a call received at 6:34 p.m. about a home invasion in the 1300 block of Capital View Terrace in the Landover area. They arrived within minutes, Velez said, and the gunfire broke out “within seconds.”

One officer was struck in the chest, but his bullet-resistant vest prevented serious injury, the chief said. The officer also suffered leg and arm injuries, but it was not clear whether they were from gunshots.

The officer underwent surgery, Velez said.

Another officer was shot in the foot, and the third suffered a graze wound in the back but was protected by a vest from more severe injury, police said.

In a tweet earlier in the evening, police said shots were exchanged, but those arrested were not struck. They were described only as male. No names or ages were given. No charges were specified.

Police did not say whether the two in custody were suspected of being involved in both the shooting and the alleged home invasion.

“This is the call you hope you never get,” said Prince George’s County Executive Angela Alsobrooks, who appeared with the police chief Sunday evening at University of Maryland Prince George’s Hospital Center. “There’s no way to express properly the heroism that was involved tonight. All three of these officers are nothing short of heroes. They ran toward danger tonight . . . 

“This is a very frightening evening for us,” she said.

Police said the call about the home invasion was made by a woman. They said they thought it was a legitimate call, not part of an effort to ambush the officers.

A resident on the block said the shooting scene is part of the Capital View Mutual Homes development. It is just west of FedEx Field and about a half-mile south of Sheriff Road.

The woman, who spoke on the condition of anonymity because of privacy concerns, said she was alerted to the incident by the sound of numerous gunshots. She said she saw a black vehicle go down the street and then turn around at a dead-end.

A second neighbor said that after the car went back down the street, she saw someone in the vehicle apparently shoot at a police car. The windshield of the police car shattered, said the woman, who also spoke on the condition of anonymity because of privacy concerns.

Both neighbors said the black vehicle did not go far before crashing.

The second neighbor said the vehicle struck an obstacle on the sidewalk with a loud boom.

She saw officers and rescue personnel begin to tend to an officer who appeared to have a leg wound. Then, she said, they turned their attention to one of the other two officers, who was in the police car with the shattered windshield.

The number of officers hit by the gunfire appeared to be one of the largest in the Washington area in more than three years.

Three Prince William County officers were shot and one of them was killed in an incident in February 2016.

Late Sunday, Maryland Gov. Larry Hogan tweeted, “We are all extending our prayers to the three officers shot tonight in Prince George’s County.”

Hogan also said Maryland State Police have “offered its full support for the investigation.”

Emily Davies contributed to this report.