Venezuela has declared a week of mourning after the death of president Hugo Chavez.

Thousands of supporters accompanied the hearse carrying his coffin to the military academy where his body will lie in state until his official funeral on Friday.

The 58-year-old leader died last night after being diagnosed with cancer in recent years.

He had suffered multiple complications following his latest operation on 11 December and had not been seen in public since then.

The leader had passionate support from the poor, but alienated opponents who called him a dictator.

The future of his self-styled leftist revolution now rests on the shoulders of his preferred successor, Vice President Nicolas Maduro.

"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," Mr Maduro said.

"We ask our people to channel this pain into peace."

Just hours before the death, Mr Maduro alleged that "imperialist" conspirators had infected the president with cancer among a plethora of conspiracies with domestic opponents.

Military commanders quickly pledged loyalty to Mr Maduro, a 50-year-old former bus driver and union leader, who becomes caretaker leader until the new election.

Venezuela's opposition parties have unanimously agreed with state governor Henrique Capriles that he will run in the upcoming presidential election.

Mr Capriles lost to Mr Chavez in an election last year.

The authorities said a new vote would be called within 30 days, but it was not immediately clear if that meant the election would be held within 30 days or whether the date for the ballot would be announced within that time.

Much of Caracas, Venezuela’s capital city, was quiet overnight, with streets deserted, especially in richer parts of the city.

Most shop owners had locked their doors as the news of Mr Chavez's death spread, fearing looting.

Despite having weeks to come to terms with their leader's likely demise, Chavez supporters were wrought with grief.

Hundreds of emotional "chavista" loyalists gathered outside the military hospital where the president spent his final two weeks.

Messages of condolence

Messages of condolence came from UN Secretary General Ban Ki-moon, and ideological friends and opponents alike across Latin America, as well as Mr Chavez's ally Iran.

Cuba and Iran have both declared days of mourning following the death of the Venezuelan leader.

Iranian President Mahmoud Ahmadinejad may attend the funeral on Friday, state news agency IRNA reported.

President Michael D Higgins said he was sorry to hear about Mr Chavez's death.

He said: "President Chavez achieved a great deal during his term in office, particularly in the area of social development and poverty reduction."

US President Barack Obama said his administration was interested in "developing a constructive relationship with the Venezuelan government".

The UN's main human rights forum observed a minute's silence today for Mr Chavez, whose record it has often criticised over the years.

The UN Human Rights Council has voiced repeated concerns about freedom of expression, lack of independence of the judiciary, restrictions on activists, and arbitrary detentions in Venezuela under Mr Chavez.

Future of Venezuela

Mr Chavez's death will test whether his leftist "revolution" can live on without his over-arching personality at the helm.

He easily won a new six-year term at an election in October and millions of supporters loved his charisma, anti-US diatribes and oil-financed projects to improve life for residents of long-neglected slums.

Critics, however, saw his one-man style, nationalisations and often harsh treatment of rivals as evidence he was a dictator whose misguided economics squandered a historic bonanza of oil revenues.

One recent opinion poll gave Mr Maduro a strong lead over Mr Capriles because he has received Mr Chavez's blessing.

Mr Maduro has been a close ally of Mr Chavez for years and would be very unlikely to make significant changes to the late president's policies.

However, he could at some point try to ease tension with investors and the US government.

A victory by Mr Capriles would bring in much deeper changes and would be welcomed by business groups and foreign investors.

However, he would probably move cautiously in order to lower the risk of political instability and violence.

The government never said what type of cancer Mr Chavez had, but experts suspect it was a soft-tissue sarcoma.