Hundreds of thousands of people demonstrated in Yemens rebel-held capital on Sunday in a show of support for the insurgents, two years after a Gulf coalition intervened against the rebels.

The Iran-backed Huthi rebels staged a show of force over the weekend with the mass rally in Sanaa and a symbolic court ruling against Yemen's embattled president, whose troops are supported by the Saudi-led Gulf coalition.

Crowds converged on Sabeen Square in Sanaa, raising banners in protest against the Saudi-led intervention and chanting a vow to "resist to the end".

"We came back today to Sabeen Square to send a message to Arabs and Muslims: does your religion allow you to attack a people in its totality without any reason?"Abdullah Qadiry told AFP at Sabeen Square.

Former president Ali Abdullah Saleh, a Huthi ally and political rival of current head of state Abedrabbo Mansour Hadi, appeared briefly in person at the rally to thunderous applause.

Sunday's protest came a day after a rebel court in Sanaa sentenced Hadi to death in absentia for high treason.

The court found Hadi guilty of "usurping the title of president after the end of his term in office... instigating attacks by Saudi Arabia and undermining the independence and integrity of the Republic of Yemen", the rebel-controlled Saba agency said.

Six members of the Hadi government were also sentenced to death.

Hadi, whose two-year term in office expired in February 2014, now lives in Saudi Arabia, although he also visits his government's temporary capital of Aden.

Iranian 'plot'

The president was placed under house arrest after the Huthis overran the capital in September 2014, and later fled to the southern port city of Aden.

The Gulf coalition intervened with air strikes on March 26, 2015, after Huthis advanced on other parts of the country including Aden.

Hadi's forces have since gained ground in the south, but the Huthis still control the capital and strategic ports on the Red Sea coast.

The government-run Saba news agency on Sunday ran an editorial slamming the "rise of the Huthi militia" as an Iranian "plot" targeting Yemen and neighbouring Saudi Arabia.

On Saturday, Ali Abdullah Saleh denounced Riyadh's role in the conflict.

"Free Yemenis will continue to choose resistance, as long as the coalition led by Saudi Arabia continues to choose war," Saba quoted Saleh as saying in a speech marking the anniversary.

Rebel leader Abdul Malik al-Huthi said the coalition had been "living under the illusion that they can take Yemen in a week or a month... but have sunk into the mud".

Possible 'war crime'

Home to one of Al-Qaeda's most dangerous branches, Yemen has a complex history of civil unrest.

The rebels, who had long complained of marginalisation, in 2011 mobilised protests demanding economic and political reform that led to Saleh's resignation the following year after decades in power.

But the Huthis and Saleh put their differences behind them in 2014, as the rebels took Sanaa with the support of troops still loyal to the former president.

More than 7,700 people have been killed and three million displaced in Yemen since March 2015, the United Nations says.

This month, 42 people, mainly Somali refugees, were killed when a boat transporting them out of Yemen came under air attack off the main Red Sea port of Hodeida.

On Sunday, Human Rights Watch said there was evidence the attack may have come from the coalition and could amount to a war crime.

Saudi Arabia has denied involvement and called for the UN to take control of Hodeida port, which is currently in the hands of the Huthis.

The UN has described Yemen as the worst humanitarian crisis in the world today, with fighting leaving millions desperate for food and shelter.

It says the country also faces a serious risk of famine this year.