Backers of Venezuela's opposition leader Juan Guaido left the country's embassy in Brasilia on Wednesday, after a tense 11-hour standoff that created a diplomatic embarrassment for Brazil's right wing government.
Brazil's foreign ministry said a diplomat it sent to mediate a peaceful end to the dispute managed to convince the group of 10 people to leave the mission.
Representatives of Venezuelan President Nicolas Maduro later regained access to the building, creating a tricky situation for Brazil's President Jair Bolsonaro, who has recognized Guaido as the legitimate leader of Venezuela.
The incident caused scuffles outside the embassy in an embarrassment for Brazil's government as it hosts the BRICS summit of major emerging economies in the capital on Wednesday and Thursday. Leaders Xi Jinping of China and Vladimir Putin of Russia, who support Maduro, attended the event.
Venezuelan Foreign Minister Jorge Arreaza said on Twitter the "violent" occupation had ended peacefully, thanks to the intervention of the Brazilian authorities.
Members of the Guaido group said embassy staff had allowed them to enter the embassy in the morning and that they did so peacefully.
Guaido's envoy in Brazil, Maria Teresa Belandria, has not been able to access the embassy since she arrived 10 months ago and has been living and working out of a Brasilia hotel.
Crowds of Brazilians who gathered outside the embassy to support the rival claims of Maduro and Guaido traded insults and some came to blows before police could separate them.
"The Brazilian government ordered us to leave our country's embassy and we were escorted out by the back door like delinquents," Venezuelan Army Mayor Jose Gregorio, who deserted to Brazil this year, said by telephone after leaving the embassy.
Venezuelan embassies around the world have become flash points for the competing claims of Guaido, the head of country's National Assembly, and Maduro, a socialist who took over from late President Hugo Chavez in 2013.
Earlier this year, Guaido invoked constitutional provisions to assume an interim presidency, arguing that Maduro's re-election last year was fraudulent. He has since been recognized by most Western nations as the rightful leader of Venezuela.
An occupation by protesters at the Venezuelan embassy in Washington in May resulted in arrests before the building was returned to Guaido's representatives, who are recognized by the United States.