TEHRAN - The trial of protesters accused of ransacking the Saudi embassy in Tehran opened Monday in the Iranian capital with 21 suspects accused of "destruction", the judiciary's news agency reported.

Mizan Online said 21 out of 48 defendants appeared in court for the first hearing and were formally informed by the prosecutor of the charges against them.

They are accused of "disrupting public order and destruction", Mizan Online said.

The Saudi embassy and its consulate in Iran's second city Mashhad were stormed and burned on January 2 in protest against the execution of Sheikh Nimr al-Nimr, a prominent cleric from Saudi Arabia's Shiite minority.

Oil-rich Saudi Arabia and some of its Sunni Muslim Gulf allies severed diplomatic relations with Shiite-ruled Iran the next day.

Iran hopes that the trial will restore international confidence.

"Every country is responsible for the security of its foreign embassies," President Hassan Rouhani said in late June.

"People want to know how a bunch of rogue individuals who attacked a foreign embassy in breach of the law and against the country's public security... will be dealt with by the judiciary," he said.

The embassy attack was condemned by Iran's top authorities, including supreme leader Ayatollah Ali Khamenei.

Mizan Online said that some of the 21 accused, who appeared in court along with their lawyers, "presented their defence" during the first hearing. The agency did not elaborate.

It said that the trial would continue but did not say when the next hearing would take place.

Judiciary spokesman Gholamhossein Mohseni Ejeie said in April that 48 people would face trial over the attacks but it was not immediately clear why only 21 appeared in court on Monday.

Saudi Arabia and Iran are locked in a fierce competition for regional influence, backing opposing sides in conflicts such as Syria and Yemen.

Tensions have further soured after the two countries failed to conclude an agreement for Iranian pilgrims to attend the annual hajj pilgrimage to Saudi holy Muslim sites in September.

A major contentious issue has been security, after a stampede at last year's hajj killed about 2,300 foreign pilgrims, including 464 Iranians.