FRAMINGHAM – A Framingham man who authorities say vowed to kill police and then opened fire on them Thursday will be held for a mental health evaluation, a Framingham District Court judge ruled on Friday.

Justin Breakspear, 31, fired a rifle at six officers around 8:30 p.m. when they went to 14 Whiting Road after a call about a domestic dispute, prosecutor Wendi Safran said during Breakspear’s arraignment.

The incident sparked a “shelter in place” warning to residents in the Nobscot neighborhood Thursday night and led to dozens of police officers swarming the northside in a two-hour manhunt and standoff.

During an argument with his girlfriend, Breakspear menacingly swung a rifle around. He threatened to go to the police station and shoot officers, the prosecutor said.

“He told her he would kill all of the Framingham police officers for what they’ve done to him in the past,” Safran told Judge David Frank. “He told her he was not going to go back to prison.”

When police arrived at the home, Breakspear was outside with a black rifle on his shoulder. He “took a defensive position and fired at the six officers,” the prosecutor said. He fired a single shot, authorities said.

No one was hit or injured. Breakspear dropped his gun and ammunition and ran. He ended up on the roof of Slice of New York, a pizza parlor at 847 Edgell Road, where he eventually surrendered to police.

Town records indicate Breakspear has been a tenant of the strip mall at 847 Edgell Road since at least October 2015. His business, formerly known as Neko’s of New York, was later renamed Slice of New York. Breakspear personally appeared before the Board of Selectmen as recently as December to discuss progress on installing a necessary grease trap at the restaurant.

Mark Eisner of Framingham, a customer of Slice of New York, praised Breakspear’s dedication to the business.

“He’s been working incredibly hard to make this place work. He’s been there all day long,” Eisner said.

Police charged Breakspear with six counts each of attempted murder and assault with intent to murder. They also charged him with assault with a dangerous weapon (gun), four counts of possession of a large capacity gun, carrying a gun without a license, possession of a gun during the commission of a felony, discharging a gun within 500 feet of a dwelling, possession of a gun after two violent crime or drug crime convictions, using a gun during the commission of a felony and possession of ammunition without an FID card.

Safran asked Frank to hold Breakspear without bail pending a hearing to determine if he is a danger to the public. Along with citing the seriousness of the crime, Safran said Breakspear has been convicted numerous times for gun charges, as well as drug and assault charges. In all, he has been convicted 30 times.

One of those arrests was from 2005, when deputies from the Middlesex Sheriff’s Office tried to serve an arrest warrant on Breakspear. They found Breakspear hiding in the basement of his apartment building with a gun nearby.

Breakspear denied the gun was his, but he had a tattoo of the gun, along with the serial number, on his waist. He was convicted in 2006.

Breakspear’s lawyer, Daniel Cappetta told Frank he is concerned about his client’s competency.

After meeting with Breakspear, psychologist Frederick Kelso told Frank he had many of the same concerns as Cappetta.

“He has a meager understanding of the charges that are brought against him,” said Kelso. “He expressed hope that he would be released today, which shows me he has a lack of appreciation of the gravity of the charges he faces.”

Breakspear told Kelso he suffers from attention deficit disorder, depression and other issues. Kelso said his depression level lately has been a “9.5 or 10,” and he has been thinking about suicide.

Kelso recommended sending Breakspear to Bridgewater State Hospital for a competency exam that could last as long as 20 days.

Frank ordered Breakspear held without bail for the competency exam.

Breakspear is due back in court on Wednesday for a status hearing and perhaps the dangerousness hearing.

Daily News staff writers Jim Haddadin and Brian Benson contributed to this report.

Contributing to this report were Norman Miller, Brian Benson, Jonathan Phelps and Jim Haddadin