Google has agreed to take down videos that violated Brazil's electoral code after the company's latest appeal was rejected by the courts, reports Reuters.

Google Brazil

Earlier in the week, a judge ordered Fabio Coelho, one of Google's senior executives in Brazil, to be arrested and questioned after the company refused to take down videos that attacked a local mayoral candidate.

Coelho was detained by the police on Wednesday, before being released later that day.

Google is known for complying with local laws and regulations, for example blocking music video content in Germany. However the search engine giant will object to taking down content when it feels the regulations are unreasonable.

"If a video is illegal in a particular country, we will restrict access to it, after receiving a valid court order or government complaint," Coelho said in a statement, adding that "because we are deeply committed to free expression, we often push back on requests that we do not believe are valid."

Google's appeal against the ruling was rejected on Wednesday, leaving the company with no other choice than to take down the original poster and shut down the account.

Coelho said the ruling was the result of popular pressure, adding that "we are profoundly disappointed to not have the opportunity of openly debating our arguments in the electoral justice system that the videos were legitimate manifestations of the freedom of expression and should continue (to be) available in Brazil.

"Despite this, we will continue with our global campaign for liberty of expression, not just because it is a prerequisite for a free society but also because more information generally means more schools, more power, more economic opportunities and more liberty for people."