SABATTUS, Maine — David Marsters has apologized for posting a racial slur and threat against President Barack Obama on Facebook and has resigned from all of his municipal board appointments.

Marsters submitted his resignation by email to Town Manager Andrew Gilmore just before 8 a.m. Thursday, writing that “effective immediately I am resigning from all committees and commissions,” which include the ordinance review committee, budget committee and charter commission.

“I deeply regret what I posted and do apologize for my actions,” he wrote.

Marsters, who is a retired police officer, became the target of heavy criticism this week after the Sun Journal reported Tuesday on a week-old Facebook post in which Marsters wrote “Shoot the N——-” atop a photo of the president.

When someone criticized the posting, the user said Obama “is not a legal president.”

Gilmore said the comments were “deplorably hateful, dangerous, and exactly opposite of all this country and the town of Sabattus stands for.”

Within hours of Marsters’ post becoming public Tuesday, the Secret Service interviewed Marsters at his home and later interviewed his wife and neighbors. Police also searched Marsters’ home for guns.

Marsters has not been charged with a crime.

The selectmen had scheduled an emergency meeting tonight to consider removing Marsters from service on all town boards and committees on which he serves. On Wednesday, Gilmore said Chairman Mark Duquette called the emergency board meeting because “he believes, and I agree wholeheartedly, that timing is of the essence to make it very clear that the town government and this community as a whole are in no way aligned with Mr. Marsters, and what we perceive to be his extreme, radical views.”

According to Gilmore, town officials “encourage everybody’s right to have ideological views anywhere on the spectrum,” but Marsters’ offensive call to harm the president “clearly steps way over the line,” Gilmore said.

Earlier this year, Marsters, who said he owns one handgun, wanted the town to require, by ordinance, every household to own a gun and ammunition. Selectmen refused to consider such an ordinance, and Marsters proceeded to take out papers to run for selectman this fall.

Interviewed at his home Tuesday night, Marsters said his Facebook post was taken out of context. He insisted no threat was made because he didn’t say he or anyone else was actually going to do it.

“I’m pissed off at the system, OK,” he said, noting that he was worried his family might lose health benefits under the Affordable Care Act. He blames Obama, whom he says was elected to office thanks to the use of a false birth certificate and other identifying documents.

“I apologize for what I said; that’s all I can say,” Marsters told the Sun Journal. “I did it out of frustration against the man.”