Image copyright ACLU Image caption Josh Harms considers Sibley, Iowa his hometown

A town in Iowa has agreed to drop a lawsuit against a resident who criticised officials because the place smells like "rancid dog food".

A federal court sided with web developer Josh Harms, issuing a permanent injunction ordering Sibley, Iowa, officials not to sue him.

Sibley officials threatened legal action over Mr Harms' website 'Should You Move to Sibley, Iowa?'

Mr Harms argued the threat was a violation of his right to free speech.

The town contacted Mr Harms in December 2017 and told him he had 10 days to remove his website, or they would take him to court.

On the site, the web developer had described his hometown as having a "horrible rotten-blood and stale-beer odour that hangs over the town".

The odour in question is coming from a pork blood processing plant.

On 9 March 2018, the American Civil Liberties Union (ACLU) of Iowa filed a lawsuit against Sibley, arguing it had violated Mr Harms's constitutional right to criticise the government without fear of repercussion.

On Thursday, a judge issued an injunction blocking Sibley from making legal threats against Mr Harms.

The injunction bars the town from "directing Harms not to speak with reporters, threatening to bring a lawsuit, or actually bringing a lawsuit against" him.

According to the local paper, Sibley also agreed with the ACLU to:

Provide First Amendment (free speech) training to town staff

Issue a written apology to Mr Harms for the threat to sue

Cover $20,475 (£14,000) in legal fees

Pay $6,500 in damages to Mr Harms

"I'm happy that the city of Sibley has recognised they were wrong to threaten me for the criticism I've written and published online," Mr Harms said, according to the Des Moines Register.

He said he has acquired the web domain for "sibleystinks.com", but has yet to decide whether to make the website live.

"The right of the people to freely and openly criticise their government is the very foundation of democracy," said Rita Bettis, legal director for ACLU Iowa.