ELLSWORTH, Maine — State agriculture officials are suing a Blue Hill farmer to stop him from selling unpasteurized milk in a case that could test the legality of “local food” ordinances in Maine that attempt to exempt some farmers from state and federal regulation.

Maine Department of Agriculture officials insisted Wednesday their lawsuit against Dan Brown of Gravelwood Farm was motivated by health concerns over his sale of unpasteurized milk without a license despite repeated warnings.

“It was not done as a statement,” Agriculture Commissioner Walter Whitcomb said Wednesday. “There were people who contacted our inspectors from that area, believe it or not, who were concerned that this might be a potential health problem.”

But Whitcomb acknowledged the case is viewed as part of a bigger regulatory turf war between the state and five Maine towns with ordinances asserting local control over farm products. Brown and advocates for “food sovereignty,” meanwhile, are planning a rally in Blue Hill on Friday to draw attention to an issue also playing out in other states.

“We feel like there is a national agenda both on raw milk and on these private sales,” said Bob St. Peter, a farmer from Sedgwick and director of Food for Maine’s Future, an organization focused on local food control issues.

The lawsuit filed earlier this month in Maine Superior Court in Ellsworth accuses Brown of selling milk without a distributor’s license, selling unpasteurized milk without a label declaring it as such, and selling food without a license.

According to court documents, department inspectors observed Brown selling milk or milk products from his farm stand or at local farmers’ markets on six occasions this year. When confronted, Brown reportedly told inspectors he had no intention of obtaining a license.

And Brown said Wednesday that he doesn’t believe he needs one. Instead, he argues inspectors are wrongly reinterpeting state law and falsely disregarding local ordinances.

“I’m not breaking any laws,” Brown said. “I have a copy of the state law and I have a copy of the ordinance here in Blue Hill, and that is how I have always operated.”

The fact that the alleged violations involve a Blue Hill farmer and occurred in Hancock County — a hotspot among Maine’s vibrant local foods movement — adds a potential wrinkle to the case.

Blue Hill is one of five towns that have adopted “local food and community self-governance ordinances” stating that farmers or food processors are exempt from licensing and inspection as long as they sell directly to consumers for home consumption. The four other towns are Sedgwick, Penobscot and Trenton — also located in Hancock County — and Hope in Knox County.

The ordinances are couched in constitutional language asserting that people have the “fundamental and inalienable right to govern themselves” and warning against other government agencies attempting to pre-empt the local ordinance.

According to proponents, such ordinances are intended to protect farmers who sell their goods at farm stands, farmers’ markets, bake sales or directly to customers. Additionally, many consumers have more trust in the quality and safety of the food they buy from local farmers than in food grown by distant farms run by large corporations, St. Peter said.

“It codifies into local law the way our communities have been operating up until fairly recently,” said St. Peter. But he said he believes Maine officials are capitulating to pressure from federal officials who in turn are primarily interested in helping the corporate agribusiness industry.

Whitcomb, who is a farmer himself, acknowledged that the “buy local” ethos is strong in Maine and said his department “bends over backward to try to cooperate with and help” small farmers in the state. In fact, the department operates the licensing and inspection program for raw milk at a financial loss to help those farmers despite the fact that the federal government would prefer that Maine prohibit the sale of unpasteurized products.

But Whitcomb said the reality is the federal government requires health and safety safeguards for good reason and he added that “the feds are watching very closely.” He noted that 32 operations are licensed to sell raw milk in Maine while 67 are licensed to sell cheese.

In Brown’s case, inspectors who purchased milk and cottage cheese from the farmer in July found the samples had bacteria counts 10 to 15 times higher than the legal limit. The agriculture commissioner added that the department would have preferred to resolve the issue without the courts.

“There are really some serious concerns,” Whitcomb said. “There have been significant efforts by inspectors with the department to work with Mr. Brown to point out the changes that need to be made to get a license.”

For his part, Brown seemed to disagree that the department inspectors have always been cooperative. As an example, Brown said the department never contacted him about the alleged high bacteria counts in his products. Instead, he learned about it from the lawsuit paperwork.

“If you tell me there is something wrong with my milk, I want to change it,” Brown said. “I don’t want to make anybody sick.”

Brown insisted that the department is reinterpreting its own rules, perhaps in response to federal pressure. He said he absolutely believes the lawsuit is intended as a test case.

“They are just going after me to go after the [town’s] ordinance,” he said.

Brown has 20 days from being served with the complaint, which was dated Nov. 3, to file a written response with the court.