Burials were held in the provinces for the two others killed when gunmen and suicide bombers stormed Tehran's parliament complex.
Tehran: Tehran hit out at Washington and Riyadh as tens of thousands attended the funerals Friday for those slain in the first attacks in Iran claimed by the Islamic State group.
"Death to America", "Death to the Saud" ruling family, and "We are not afraid", shouted the crowd gathered behind a lorry bearing the coffins of 15 of the 17 people killed in Wednesday's attacks.
Burials were held in the provinces for the two others killed when gunmen and suicide bombers stormed Tehran's parliament complex and the shrine of revolutionary leader Ayatollah Ruhollah Khomeini. Fifty people were wounded.
Nine people suspected of ISIS links have been arrested, a website close to the judiciary said Friday, as mourners paid their respects to those killed at a ceremony attended by newly re-elected moderate President Hassan Rouhani.
Supreme leader Ayatollah Ali Khamenei had initially played down the attacks, describing them as "firecrackers" that "will not have the slightest effect on the will of the people".
On Friday, however, he turned his wrath for the attacks on the United States and Saudi Arabia, his country's fiercest rivals. "Such acts will have no other result than to reinforce hatred for the US government and its agents in the region, like the Saudi (government)," Khamenei wrote in a message of condolence to the families of the dead.
Parliament speaker Ali Larijani also attacked the United States and Saudi Arabia, which he called "a tribal state very far from anything like a democracy".
In a speech at the ceremony, Larijani denounced US sanctions against Iran over its ballistic missile programme. The US "knows that the Revolutionary Guard and its Quds force are the most important regional forces fighting terrorists", he said.
The imposition of such sanctions "demonstrates their alignment with terrorists in the region", said the speaker, a moderate conservative. After prayers at Tehran University, a long procession left the centre of the capital headed for Behesht-e-Zahra cemetery, near the Khomeini mausoleum, 20 kilometres (12 miles) away.
The attacks, which struck two of the country's most symbolic landmarks, were carried out by five armed men, including suicide bombers who blew themselves up. The intelligence ministry said they were Iranians who had joined the Islamic State group and travelled to its strongholds in Iraq and Syria before returning home.
Iran is a key fighting force against ISIS and other groups in Iraq and Syria, and the Sunni jihadists consider Shiite Muslims to be apostates. Shiites make up roughly 90 percent of Iran's population, but the country also has a sizeable Sunni minority, particularly around its restive borders with Iraq and Pakistan.
ISIS released a video overnight of the five attackers before the assault, via its Amaq propaganda agency. "Allah permitting, this is the first brigade that was established (in Iran) but it will not be the last," one of them said, as the group sat masked in a circle with their weapons.
The jihadist group had earlier released footage of the attackers from inside the building, also via Amaq a rare claim of responsibility while an assault was still going on. Although the US military is also fighting ISIS in Syria, as well as Iraq, President Donald Trump said in response to the attacks in Iran that the country is reaping what it sows.
That drew fire from Iran's foreign minister, Mohammad Javad Zarif, who tweeted: "Repugnant WH (White House) statement as Iranians counter terror backed by US clients." Since Trump took office in January, relations between Washington and Tehran have worsened.
Washington has imposed new sanctions on Tehran for its alleged support of "terrorist" groups in the Middle East, ballistic missile tests and human rights abuses.
On a recent trip to Sunni-ruled Saudi Arabia, Trump called on all nations to "isolate" Iran. The Islamic republic's elite Revolutionary Guard has accused regional rival Saudi Arabia of involvement in Wednesday's attacks.
But Intelligence Minister Mahmoud Alavi said on Thursday that "we still cannot judge that Saudi Arabia has had a role in this terrorist incident".
The Mizanonline website, which is close to the judiciary, said nine people suspected of ISIS links were arrested, seven of them on Thursday night in Fars province and the other two on Friday morning in Kermanshah province, near the border with Iraq.