(NECN: Kristen Carosa) - Twenty-nine-year-old Devon McLeod and 18-year-old Kasiem Smith hid behind a door at Worcester District Court Friday.
The two men face multiple charges, including home invasion and armed assault with intent to murder.
Police say they are known as dangerous gang members in the city of Worcester.
"These suspects were willing to do all that was necessary to evade capture," Worcester Police Sgt. Kerry Hazelhurst says.
Sgt. Hazelhurst says it was the two men that caused parts of Grafton Hill to be shut down for hours on Thursday night.
When police arrived at a three decker on Cohasset Street just after 11 p.m., officers could see both Smith and McLeod masked inside with handguns.
"They were yelling at the people inside to show their hands and asked them to keep them up," Sgt. Hazelhurst says.
A SWAT team arrived to back up the officers.
At that time a window smashed and gun shots were heard as the two men tried to escape.
"The officers were right there - they saw the muzzle flash of the gun - it was apparent to them that they were being fired upon and at that point they ran for cover," Sgt. Hazelhurst says.
According to police, one of the suspects was caught just outside the apartment and the other was caught after a brief foot chase.
At that time, police went into the building checking for additional suspects and potential victims.
"Police made contact with everyone inside - convinced them to come out and they were checked out by police," Sgt. Hazelhurst says.
Hazelhurst says no one was injured, but police found marijuana, cash and firearms.
Twenty-year-old Jonathan Ren - who lives in the apartment - was arrested and charged with possession and intent to distribute.
A positive outcome for what police call a dangerous situation.
"We are just thankful that no officers were hit through all of this and were thankful that two dangerous men are now off the street," Sgt. Hazelhurst says.