A standoff in the Penobscot County town of LaGrange ended Sunday night when a Maine State Police trooper shot and killed an armed man who had threatened violence, authorities said.

Stephen McCausland, spokesman for the Maine Department of Public Safety, said late Sunday that Sgt. Scott Hamilton fatally shot Lewis Conlogue, 49, of LaGrange.

Conlogue had held police at bay for three hours outside a former restaurant, Island Farm, on Route 16, also known as Bennoch Road, McCausland said.

He said Conlogue died at the scene.

Hamilton has been placed on administrative leave with pay while the shooting is under investigation, McCausland said.

The Maine Attorney General’s Office will investigate the circumstances that led to the shooting in LaGrange, which is northwest of Bangor and Old Town.

Brian MacMaster, the office’s director of investigations, said late Sunday night that he had a team of four detectives at the scene of the shooting.

MacMaster said the incident began as a standoff after deputies from the Penobscot County Sheriff’s Office responded to the report of a domestic disturbance around 4 p.m.

The Maine State Police tactical team was called in after Conlogue threatened violence. The standoff ended around 7 p.m.

In Maine, it is standard procedure for the Attorney General’s Office to investigate all police-related shootings and to determine if the shooting was justified.

The shooting Sunday night was the fifth officer-involved shooting in Maine this year.

From 2000 to December 2012, police in Maine fired their guns at 71 people, striking 57 of them. Thirty-three of those people died. A review of the 57 shootings by the Portland Press Herald/Maine Sunday Telegram in 2012 found that at least 24, or 42 percent, involved people with mental health problems. Seven of the shootings were alcohol-related. Two involved drugs.

Of the 33 people killed, at least 19, or 58 percent, had mental health problems.