A Massachusetts man has been arrested after allegedly firing a shot while inside his Rockland residence Friday evening, according to police.

Police arrested Richard Blaikie, 68, who they said has mental health issues and was under the influence of alcohol when he fired the shot at his home on Chestnut Circle.

According to Rockland Police Chief John Llewellyn, Blaikie was allegedly upset because he had gone in for a mental health check up earlier in the day and had been denied a medication he sought from the doctor.

Police say the suspect returned home, started drinking, and then fired the shot, which they say went through a few walls before exiting the home.

Police say the suspect's son and daughter were home when the shot was fired and that the man shot in the direction of his son after the two got into an argument. The shot did not hit the suspect's son and no one was hurt.

After the shot was fired, Blaikie barricaded himself inside his house and refused to come out, police say.

Homes in the immediate vicinity of the house were evacuated, according to state police, and residents of other homes in the area were ordered to shelter in place.

“I got a steel door, I was hiding behind it," said neighbor Ken Smith.

The Metropolitan Law Enforcement Council SWAT team joined local and state police on the scene after receiving a report of a gun being fired.

Local police say that after several hours and a phone call with a longtime friend, the suspect was persuaded to exit the house with his hands up.

Blaikie was taken into custody without incident and transported to South Shore Hospital. He was later released back into police custody, police say.

The state police bomb squad searched the man's residence for explosive devices and found some weaponry and bomb-making equipment in the suspect's home and vehicle.

“In conversations with the suspect’s family members, he told them on a number of occasions he would shoot the first police officer that he saw," Llewellyn said.

Police charged Blaikie with attempted murder, possession of a large capacity firearm, discharging a firearm within 500 feet of a building, assault in a dwelling, possession of ammunition without a firearms identification card, and disorderly conduct.