Two police officers in Boston were seriously injured and a suspected gunman armed with a rifle was killed during a shootout late Wednesday night, authorities said.

The officers were both in “extremely critical” condition following the shooting, William B. Evans, the Boston police commissioner, said during a news conference early Thursday morning. After undergoing surgeries and receiving blood transfusions, they were in stable but critical condition later in the day, he said during an afternoon briefing.

Evans said that several officers were responding to a report of a “domestic incident” involving two men who were roommates, one of whom was believed to have a gun. After police went inside the home, “officers were screaming ‘officer down'” on the radio, Evans said.

“Domestic calls…are probably the most volatile,” Evans said during the briefing outside Massachusetts General Hospital, where the officers were both being treated. “You never really know what you’re walking into.”

More officers went inside and some exchanged gunfire with the attacker, Evans said, while others dragged the two injured officers out of the line of fire. During the shootout, police officers shot and killed the man, later identified as Kirk Figueroa, 33, of East Boston. (The police initially gave his name as Kurt, not Kirk, but soon corrected that.)

Evans said he had heard reports that the domestic incident began with a dispute over a thermostat, though he noted there were likely other “underlying issues.”

Figueora did not have a license to carry a firearm in Massachusetts, Evans said. And while Figueora has been identified in media reports as a constable, Evans noted that people in these roles serve subpoenas and other civil things and compared the role to that of a mailman.

On Wednesday afternoon, police identified the two injured officers as Matthew Morris, a 12-year veteran of the force, and Richard Cintolo, a 27-year veteran.

Evans said that Figueroa was wielding a “tactical rifle” and wearing a ballistic vest during the shootout. Earlier Thursday, Evans had described the weapon as an assault rifle.

For a brief period after the shooting, authorities asked people in the area to shelter in place until they determined the area had been secured.

Both officers who were wounded underwent surgery overnight and remained in critical condition Thursday, police officials said.

Evans praised the actions of the officers who provided first aid to the two who were injured, saying that one police officer “had his hand in one of the wounds” while trying to stop the bleeding. The quick thinking and immediate aid was “instrumental” in helping the officers, he said.

Morris was struck in an artery in his leg, and doctors later said that said a tourniquet applied to his leg at the scene “helped save his life,” Evans said during a Thursday afternoon press conference.

“We’re still praying … and we’re hoping they make a full recovery,” he said.

Evans said police did not believe the gunman planned the incident to attack officers. The shooting in Boston came just days after two police officers in Palm Springs, Calif., were shot and killed responding to a reported domestic disturbance there. While fewer officers are killed each year than have been in prior decades, police have said they feel increasingly anxious amid nationwide protests that focus on how they use force.

The number of officers fatally shot this year has spiked after ambush attacks in Dallas and Baton Rouge, contributing to a weary fear among law enforcement. So far this year, 45 officers have been shot and killed, up from 30 such deaths at the same point last year, according to the National Law Enforcement Memorial Fund. There have also been officers who have been shot but survived, such as the Philadelphia officer wounded by an attacker who authorities said later pledged loyalty to the Islamic State, or the Florida police officer shot while in his car weeks later.

“This job’s a tough job,” Boston Mayor Marty Walsh said during the briefing. “And oftentimes, people don’t look at the other side of what happens with police officers. We’re hoping they make a full recovery.”

Nine other officers in Boston were taken to Tufts Medical Center, some with minor injuries and others with stress from the shootout, Evans said.

Suffolk County District Attorney Daniel F. Conley said his office will lead an independent investigation into Figueroa’s death, as it does whenever a police officer uses deadly force.

Conley promised “a very thorough and transparent investigation,” but said it will take time to figure out what happened because the two officers involved were “fighting for their lives.”

Figueroa was the fourth person shot and killed by the Boston police since the beginning of last year, according to a Washington Post database tracking such shootings nationwide.

Police could be seen around the home in East Boston on Thursday morning as the investigation into the shootout continued.

Further reading:

Maryville, Tenn., police officer shot and killed responding to domestic disturbance call

This story, first published at 8:35 a.m., has been updated to include information from the afternoon briefing as well as the names and photos of the two injured officers.