Three Chicago police officers were shot and injured Monday night in the city’s West Side, suffering injuries that were not life-threatening during a shootout that killed their attacker, authorities said.

All three officers were taken to the hospital on Monday night, and by Tuesday morning two of them had been released. The third was still recovering in the hospital, the police said.

These officers were conducting a drug investigation in a building’s courtyard about 9:40 p.m., when the shooting took place, said John J. Escalante, the interim police superintendent.

When the officers saw a man and woman going through the courtyard and went to talk to them, the man pulled out a gun “and immediately began firing at the officers,” Escalante told reporters during a briefing early Tuesday morning.

All three of the officers were hit by gunfire, suffering wounds in the lower portions of their bodies, Escalante said. At least one of the officers returned fire, he said, shooting and killing the man who had fired at them; the woman was not struck in the brief firefight and was being interviewed by police after the incident.

Police found a weapon at the scene, Escalante said.

The three officers were all veterans with at least 10 years on the force, Escalante said, and on Monday night, they were acting as part of a tactical team in the city’s 11th District, which includes Garfield Park and Homan Square. After the shooting, all three were taken to Stroger Hospital for treatment.

Because the attacker was killed, the incident will be investigated by the Independent Police Review Authority and the officer or officers who fired fatal shots placed on administrative duty for a month, the police said.

“Every day the dedicated men and women of the Chicago Police Department put themselves in danger so the rest of us can be safe,” Mayor Rahm Emanuel (D) said in a statement. “Tonight we were reminded of the dangers that our police face, and the bravery that they routinely display as three of our officers were shot in the line of duty.”

This shooting came at a tense moment, occurring a day after police in Maryland said a man opened fire at a police station there. Officials said this man fired randomly at the station in an ambush that ended with one officer killed, most likely by friendly fire.

So far this year, the number of police officers fatally killed in shootings is dramatically higher than it was at the same time last year. Thirteen officers have been killed by gunfire so far this year, compared with four such deaths by mid-March last year, according to the National Law Enforcement Memorial Fund, which tracks officer deaths. Overall, the number of officers who have died in the line of duty so far this year is slightly down from last year, owing to a drop in fatal traffic accidents and other causes.

Two Chicago police officers were injured late Friday in protests outside a canceled rally for Donald Trump, the Republican presidential front-runner. One of them was hit in the head with a bottle and needed stitches, Escalante said after that incident.

In Chicago, police have been under an increased amount of scrutiny in recent months. The Justice Department is investigating to see whether the police department — the second-largest local police force in the country — has violated the Constitution in its policing.

In November, after resisting for months, city officials released video footage showing a Chicago police officer fatally shooting Laquan McDonald, a 17-year-old. This officer was charged with murder the same day the footage was released. The video prompted intense protests in Chicago and calls for Emanuel and Anita Alvarez — the prosecutor who ultimately charged the officer with murder more than a year after the shooting — to step down.

After sustained demonstrations, Emanuel reversed course and dismissed Garry F. McCarthy, the city’s former police superintendent, in December. Emanuel also pledged police reforms and, shifting from his earlier position, said he supported a federal investigation of the police force.

In his first public remarks since he was ousted, McCarthy said last week that he was essentially a fall guy amid the outcry over the McDonald video. Alvarez, meanwhile, is up for reelection Tuesday, and the way she and other local officials handled the McDonald video is a key part of that race for Cook County state’s attorney.

Related: 

This story has been updated. First published: 7:54 a.m.