South American leaders have begun flying in to Venezuela to join a nation in mourning for the death of Hugo Chávez and endorse his deputy for an upcoming election campaign to choose a successor.

As condolence messages and tributes flowed in from around the world, tens of thousands of supporters marched with the president's honour guard, which escorted Chávez's coffin – draped in the national flag – on its journey from the Carlos Arevalo military hospital to the Fuerte Tiuna military academy, where his remains will lie in state for three days.

The vice-president, Nicolás Maduro – who will try to fill the public space left by the iconic leader – called on his countrymen to respond with dignity to the loss of the much-loved, but also divisive, leader.

"In the immense pain of this historic tragedy that has affected our fatherland, we call on all the compatriots to be vigilant for peace, love, respect and tranquillity," Maduro said. "We ask our people to channel this pain into peace."

Seven days of mourning have been declared and a funeral will be held on Friday that looks set to be a fittingly epic end to one of the most influential and colourful political careers of the modern era.

With his calls for a "Bolivarian socialist revolution" and supplies of subsidised oil to allies, Chávez influenced a generation of Latin American leaders, several of whom have already flown to Caracas.

Among them is Argentina's president, Cristina Fernández de Kirchner, who has ordered three days of mourning and for flags to be flown at half mast in her country, and Bolivia's leader, Evo Morales, who joined Maduro at the head of the precession and declared a week of mourning in his Andean nation. Uruguay's Pepe Mujica also arrived to pay his respects and Brazil's Dilma Rousseff was expected later on Wednesday.

Rafael Correa, president of Ecuador and one of Chávez's closest allies, had to deal with flooding in his country, but sent a message: "We have lost a revolutionary, but millions of us remain inspired."

In Cuba, the government of President Raúl Castro announced two days of national mourning, and expressed "deep and excruciating sorrow" at the loss of "one of their most outstanding sons".

According to the constitution, an election for a successor must be held within 30 days. During this mourning period, there has been little mention of politics, though the presence of so many regional leaders and allies of Chávez is likely to serve as a tacit endorsement of Maduro. Military commanders also pledged loyalty to Maduro, who will be interim president until the election.

Opposition parties told Reuters on Wednesday night that they have unanimously agreed that Henrique Capriles, who lost to Chávez in last year's election, will run in the upcoming presidential poll. Despite the bitter divisions between the government and opposition, the governor Miranda state governor stressed the need for stability.

"This is not the time to stress what separates us," Capriles said in a condolence message, calling for unity and respect for the grief that many felt."There are thousands, maybe millions, of Venezuelans asking themselves what will happen, who even feel fear … Don't be scared. Don't be anxious. Between us all, we're going to guarantee the peace this beloved country deserves."

Political rivalries will not be abated for long, particularly given the proximity of the election and the wave of sympathy that is likely to be generated by the funeral. Analysts suggested this would give an advantage to Maduro.

"The short campaign period benefits the ruling party. Because it is a time of mourning it will also be inappropriate for the opposition to be critical of the past years," said Javier Corrales, professor of political science at Amherst College.

With emotions high, the potential for the sombre mood to turn violent has been evident in occasional flashes of anger. A group of student protesters who had been demonstrating outside the supreme court to demand more information about the president's health were assaulted by an armed mob. Though they were unhurt, their tents were burned. A Colombian journalist was also beaten by angry crowds outside the hospital where Chávez had been treated. Shops in some areas were closed over fears of looting, while elsewhere there were long lines outside petrol stations. Riot troops have also been dispatched to protect the privately owned TV channel Globovision, which has been critical of Chávez.

Maduro – who has spoken of his dead boss in almost religious terms – stressed the need for unity.

"The key word in this revolution is loyalty. We have been loyal to Hugo Chávez in life, let's be loyal to Hugo Chávez and his legacy now that he has transcended," he said.

Chávez's final resting place is yet to be determined. Supporters want him to be buried in the National Pantheon alongside the nation's independence heroes and other illustrious citizens. But this move is likely to anger opponents who see him as an economically incompetent despot.