A Baltimore police officer who was hit by a bullet accidentally fired by a Baltimore County colleague during a raid on Tuesday returned fire, but did not aim at the officer who shot him, according to a police union lawyer.

Instead, the city officer fired straight ahead as he was going down a small set of stairs dividing a split-level house, according to the lawyer, Michael Marshall. The attorney said the city officer had been shot from an officer standing behind him, but thought the threat was in front of him.

“They didn’t expect to be going into a dark area,” said Marshall, who works for a law firm contracted with the Fraternal Order of Police, which is assisting both officers with the case. “The officer in the rear slipped and his gun went off. The guy who got shot thought someone in front of him shot him. He wasn’t shooting back, he was shooting ahead.”

Marshall, of the firm Schlachman, Belsky & Weiner, offered the new details to clarify what he said was a erroneous perception left by a police spokesman in Anne Arundel County, where the raid occurred, that the two officers had shot at each other during an exchange of gunfire.

The spokesman, Justin Mulcahy, had said the city officer had returned fire at a “perceived threat.” Mulcahy had declined to offer additional details.

Police officials in the city and in Baltimore County have refused to release the names of the officers, who were on a federal drug task force arresting a man in an undercover sting in Odenton. Authorities had intercepted a package address to the home and filled with 27 pounds of marijuana, police have said.

The officers, made up of several police departments, delivered the package to the house and then waited outside for the suspect to come home. They arrested him outside the house and then went inside to search.

Mulcahy said they had the sole occupant and owner, an elderly woman, in a secure location before the shooting occurred. The officers were going through the house with their guns drawn to make sure no one else was there before they began to search, the spokesman said.

Citing an ongoing investigation, Mulcahy has offered few details of the shooting. Marshall, who also refused to identify the officers involved, called the episode an unfortunate accident. The city officer suffered minor injuries and was treated and released from Maryland Shock Trauma Center that day.

Police officers are supposed to refrain from shooting unless they can identify a clear threat and a clear target, according to training manuals. Marshall said the city officer opened fire in a dark room and could at what he thought was a threat.

“He got shot,” Marshall said. “That’s a threat. When you’re down in the darkness and you get shot, you’re not going to wait until you turn the lights on.”

Mulcahy could not be reached for comment late Friday afternoon.