Iran threatened the United States Sunday with possible legal action for detaining five of its officials for up to 30 months in Iraq. The five Iranians were given a hero's welcome home after their release last week, waving and smiling as they stepped from their plane at Tehran's Mehrabad airport to be met by their families. Foreign Minister Manouchehr Mottaki, who was also there to greet them, denounced their detention as “inhumane.” The capture of the Iranians, some of whom US forces accused of arming Shi'ite Muslim militias at the height of Iraq's sectarian war, stoked tension between Tehran and Washington. The two powers are also at odds over Iran's nuclear program. They were first handed over by their US jailers to Iraq's Shi'ite Muslim-led government, which is friendly with Iran, and transferred to Iran's Baghdad embassy Thursday. Iran says they are diplomats who were held contrary to international law. “We reserve the right to legally pursue ... this action by the (George W.) Bush government,” Mottaki said on state television, adding that they had remained detained after US President Barack Obama took office in January. One of the freed Iranians sat with his young daughter on his lap and other family members chanted “Death to America”, state media reported. Iranian television last week said three of the men were detained in a 2007 US raid in Iraq's northern city of Arbil, while the two others were “kidnapped” elsewhere in Iraq. Mottaki said, in comments translated by Iran's English-language Press TV: “We hope that the (US) measure will be followed up at the United Nations and other relevant bodies.” Foreign Ministry spokesman Hassan Qashqavi told the semi-official Mehr News Agency the officials' release would not have an impact on Tehran's relations with Washington. The White House has said it handed over the Iranians at the request of the government in Baghdad, in compliance with a US-Iraq security agreement that took effect in January. Under the pact, the United States must gradually transfer more than 10,000 detainees it still holds to the Iraqi government to be either charged in local courts or released.