The president of Google operations in Brazil, Fabio Jose Silva Coelho, has said the company will take down a controversial YouTube video that led to his brief detention on Wednesday.
In a statement, Mr Coelho said he was left with no choice after losing a final legal appeal.
A regional judge had ruled that the material slandered a candidate running for mayor next month.
One of the videos has already been withdrawn by the user who posted it.
Mr Coelho said the decision, taken by a user who remains anonymous, showed "just what a chilling effect these episodes can have on free speech".
Mr Coelho was released on Wednesday night after being interviewed by detectives in the city of Sao Paulo.
Police had already made it clear that he would not remain in custody because the offence of which he is accused has "low potential to offend".
Fabio Coelho argued that Google had no responsibility for the content of videos posted on its site.
But he stressed that the company would follow its guidelines and the legislation of each country.
"If a video is illegal in a particular country, we will restrict access to it, after receiving a valid court order or government complaint," he said in the statement.
"Because we are deeply committed to free expression, we often push back on requests that we do not believe are valid."
Judge Flavio Peren, who sits at a regional electoral court in Mato Grosso do Sul state, ruled the videos violated local election laws.
His order for the videos to be removed was ignored and on Monday he ordered Mr Coelho's arrest.
"Late last night (Wednesday), we learned that our final appeal had been denied and so now we have no choice but to block the video in Brazil," said Mr Coelho.