Google has blocked a YouTube video that allegedly slanders a mayoral candidate in Brazil after losing a court battle that saw its local head of operations briefly arrested.

Google has blocked a YouTube video that allegedly slanders a mayoral candidate in Brazil after losing a court battle that saw its local head of operations briefly arrested.

The Internet search giant confirmed late Thursday that it had restricted access to the video the had deemed slanderous against Alcides Bernal, a candidate for mayor of Campo Grande, in the Mato Grosso do Sul state.

"We have no choice but to block the video in Brazil," Brazil director Fabio Coelho said in a statement, a day after he was briefly arrested over the company's initial refusal to block several campaign videos.

"We are deeply disappointed that we have never had the full opportunity to argue in court that these were legitimate free speech videos and should remain available in Brazil."

Coelho said Google had received several court orders asking it to remove videos critical of candidates and had "pushed back" on complaints it felt were invalid, adding that the arrest warrant against him had been issued while the company was waiting for an appeal to be heard.

Coelho was released after he agreed to appear in court, where he faces allegations of "disobedience" that carry a maximum penalty of a year in prison.

The videos in question accuse Bernal of "instigating abortion, , physical injury of a minor, illicit enrichment, and contempt as well as prejudice against the underprivileged," according to the indictment.

The first round of municipal elections in more than 5,000 Brazilian cities is scheduled for October 7.

On Tuesday, a Sao Paulo court gave Google 10 days to remove from YouTube any containing scenes from the "Innocence of Muslims," an anti-Islam film that has unleashed violent protests across the Muslim world.

The court in Sao Paulo—home to around 40% of the country's estimated 12 million Muslims—said failure to comply would mean a daily fine of $4,950.