* Islamic Republic's biggest bank scam tainted government
* Ahmadinejad denies fraudsters linked to top officials
* Four condemned to hang, others get jail, flogging (Adds context, further details)
By Yeganeh Torbati
DUBAI, July 30 (Reuters) - An Iranian court has sentenced four people to death for a billion-dollar bank fraud that tainted the government of President Mahmoud Ahmadinejad, state media reported on Monday.
Iranians, hit by sanctions and soaring inflation, were shocked by the scale of the $2.6 billion bank loan embezzlement that was exposed last year and by allegations it was carried out by people close to the political elite or with their assent.
Of the thirty-nine people tried for the fraud - the biggest in the Islamic Republic's history - four were sentenced to hang, the IRNA state news agency reported.
"According to the sentence that was issued, four of the defendants in this case were sentenced to death," prosecutor general Gholam-Hossein Mohseni-Ejei told IRNA.
Two people were sentenced to life and others received jail sentences of up to 25 years, Mohseni-Ejei said. In addition to jail time, some were sentenced to flogging, ordered to pay fines and banned from government jobs.
Mohseni-Ejei did not name the defendants and Iranian media have identified them only by their initials. State television broadcast parts of the trial but blurred out the faces of the accused.
The man described by Iranian media as the mastermind of the scheme, businessman Amir Mansoor Khosravi, is said to have forged letters of credit from Iran's Bank Saderat to fund dozens of companies and buy a state-owned steel factory.
Mahmoud Reza Khavari, the former head of Iran's biggest bank, state-owned Bank Melli, resigned over the affair and fled to Canada where records show he owns a $3 million home, Iranian and Canadian news agencies reported.
CORRUPTION AND PRIVATISATION
The case has been politically awkward for Iran's leadership as it aims to show it is tough on corruption and raised questions about whether the government's privatisation drive has largely benefited friends of the political elite.
Ahmadinejad has rejected claims that the investment company at the heart of the scandal has links to his closest aide, Esfandiar Rahim Mashaie, a powerful figure who has become the prime target for the president's adversaries within the hardline ruling elite.
Ahmadinejad's economy minister, Shamseddin Hosseini, survived an impeachment vote last year, where members of parliament accused him of lax banking supervision.
Acknowledging the political damage, Iran's Supreme Leader Ayatollah Ali Khamenei, while criticising financial corruption, said in televised comments last year that the media should not "drag out the issue."
"Some want to use this event to score points against the country's officials," Khamenei said. "The people should know the issue will be followed up on."
Mohseni-Ejei has held up the case as a demonstration that Iran can deal appropriately with high-level fraud. "The government, parliament, and all available devices were used to pursue the issue so that corruption can be fought in an open manner," he was quoted as saying earlier this month by IRNA.
But one of the defendents complained that, while the judiciary had pursued some low-level players in the fraud vigorously, senior officials involved in the scandal had gone unpunished.
"Many other banking officials are outside of prison right now. Why are you able to put us on trial and have nothing to do with them?" the unnamed steel company official said, according to Iran's Fars news agency.
The anti-corruption group Transparency International ranked Iran 120 out of 183 countries on its 2011 Corruption Perceptions Index, which measures countries according to their perceived levels of government corruption. (Reporting By Yeganeh Torbati; Editing by Robin Pomeroy)