PORTLAND — Maine’s highest court has upheld a lower court’s decision to dismiss a slander lawsuit filed against Washington County Sheriff Donnie Smith.

The Supreme Judicial Court found Tuesday that Smith was immune from the lawsuit because the sheriff acted in his capacity as an elected official when he ended the department’s relationship with the Maine Drug Enforcement Agency and criticized the off-duty behavior of agent Larry Hilderbrand.

Hilderbrand, who was seen in a video showing his badge and drinking beer, sued in February 2010. He was disciplined but not criminally charged.

The court heard arguments in the case last month at the Penobscot Judicial Center in Bangor.

Smith told the Bangor Daily News on Wednesday he was pleased with the decision.

Hilderbrand’s lawyer could not be reached for comment.