BOSTON — Two Boston police officers were hospitalized after they were attacked by six teenagers related to a person they were arresting, authorities said Tuesday.

Boston Police Commissioner William Evans said the officers, a woman and a man, were "pretty banged up" in Monday's attack but recovering. Both were treated for undisclosed injuries and have been released from the hospital. Their names have not been made public.

Mayor Martin Walsh said he does not believe the assault has anything to do with rising national tensions over police conduct following the killings of unarmed men in Missouri and New York City. Evans agreed but added: "It's troubling to me that all this animosity is geared toward our department because we work our hardest every day to make sure the streets of Boston are as safe as possible."

Evans said the officers went to an apartment in the city's Roxbury neighborhood Monday morning to serve a warrant on a 19-year-old man for defaulting on court appearances. Seven people were arrested in all, including the person police were originally seeking. He was identified by the district attorney's office as Woobenson Morisset.

Morisset and 18-year-old Lorcen Morisset, who is accused of participating in the attack, were scheduled for arraignment Tuesday. It wasn't known if either one has a lawyer.

The other teens, a 17-year-old boy and girls ages 13, 14, 15, and 16, face assault and battery on a police officer, resisting arrest and other delinquency charges. In juvenile court Tuesday, a judge set bail at $500 for the 17-year-old and $1 for the younger teens, with that amount to be posted only by their parents. The next court date for all five teens, who live in Dorchester, is Feb. 12.

Police say Woobenson Morisset attacked the two officers when they confronted him in a rear stairwell.

The officers were about to handcuff Morisset when the other teens came to his aid and "kicked, punched, and choked" the officers. The officers used pepper spray to fight off the attackers until other officers arrived, but they never drew their guns.

Evans said he expected the officers would be out of work for some time. "It (the attack) stresses the dangers of our job everyday going into situations never knowing what will happen," he said.