A man being sought on warrants charging him with attempted murder and sexual assault in Maryland opened fire on D.C. police officers Wednesday evening, shooting two guns as he tried to evade arrest, according to law enforcement authorities.

Officers were not struck, and police said at least one officer shot at the gunman but missed. The suspect, 34-year-old Richard Butler III, was arrested, and both weapons were recovered, according to police. The suspect has relatives in the District, and court documents also list an address for him in Virginia. He told court officials that he was homeless.

D.C. Police Chief Cathy L. Lanier said the man pulled his guns from a knapsack strapped to his chest and opened fire as the officers approached a group in the 600 block of Mellon Street SE., off Martin Luther King Jr. Avenue. Police said the suspect fired his weapon over several blocks as he fled on foot, striking five vehicles with bullets. The windshield of one vehicle, which was stopped at a traffic light, was hit. The driver was not injured.

“We don’t see cases like this all the time,” Lanier said Thursday. Noting increased tensions between police and some communities across the country, Lanier said, “I think the mentality of truly violent offenders is that they are much more likely in any jurisdiction to engage police.”

Documents filed in D.C. Superior Court say that Butler tested positive for the hallucinogenic drug PCP after his arrest and admitted to using synthetic drugs within the past 30 days. Court records show that Butler is on probation until December 2017 after having served 36 months in prison for a weapons conviction in the District. The records show he violated his release conditions three times in March because he failed to show up for drug testing.

Butler has been convicted of felonies in the District, Maryland and Virginia. He served three years in Virginia for being a felon in possession of a handgun and six years in Maryland for robbery with a deadly weapon.

The suspect is wanted by Prince George’s County police in connection with a stabbing that occurred March 7 on Tyrone Drive in Upper Marlboro. Police said the suspect’s girlfriend was stabbed several times outside a house. He was charged in a warrant with attempted murder.

Police said Butler is also wanted in a March 3 sexual assault of a young woman and a March 4 arson in which an incendiary device was thrown through an apartment window. Both incidents occurred in Landover. Butler was charged with arson and a second-degree sex offense.

Lanier said a D.C. police officer had seen Butler’s photo on a “wanted” flier earlier Wednesday. Later that evening, Lanier said, the officer saw people on Mellon Street that he believed were playing a dice game. As the officer drew closer, Lanier said, he recognized one of the men from the flier.

The arrest affidavit says that as the officer approached the suspect to identify him, the man ran to the edge of an alley, turned and fired two shots. The officer returned fire.

The court document says that the officer then chased the suspect along several alleys and streets, at one point jumping over fences, and that the gunman “kept turning around, facing [the officer] firing back at him.”

Butler faces 10 criminal charges in the District, including assault on a police officer, weapons violations and assault with a dangerous weapon.

Clarence Williams and Lynh Bui contributed to this report.