May 12 (Reuters) - Iran may be about to restore banking links with the rest of the world after years of separation, but the process won't be easy as its Islamic financial system has evolved in ways that will complicate ties with foreign banks.

Smothered in bad debt and shut out of the global system by sanctions, Iranian banks badly need to resume business with foreign lenders, for whom this would be a huge opportunity.

Iran's Islamic banking assets totalled 17,344 trillion riyals as of March 2014, or $523 billion at the free market exchange rate, according to the latest central bank data, over a third of the estimated total of Islamic banking assets globally.

But the Iranian banks' shaky finances and close ties with their government will increase the risks of dealing with them. And during their years of isolation, they have developed a version of Islamic finance that is in some ways markedly different from that practiced in other Muslim-majority states.

The differences may make it hard for foreign banks, even ones from other big Islamic banking markets in the Gulf and southeast Asia, to do business in Iran.

"Given the prevailing socio-political situation, the market in Iran has evolved to be a highly domestic, stand-alone and managed banking industry," said Ashar Nazim, partner at consultancy EY's Islamic banking centre.

BAD DEBT

The sanctions may start to be lifted in coming months if Tehran and world powers reach a deal to curb its nuclear programme by a June 30 deadline. The deal would trigger a surge of trade and investment into Iran.

In the Gulf and Europe, Iranian banks have substantial operations that have largely been mothballed in the past several years, such as Bank Melli's sprawling branch in downtown Dubai. These could spring to life if sanctions were removed.

But Iranian banks are not in good shape to exploit another boom. As the government battled the sanctions in recent years, it fixed banks' lending rates below inflation, which surpassed 40 percent in 2013. Non-performing loans peaked at 17 percent of total loans in 2013, representing almost 10 percent of non-oil gross domestic product, according to the International Monetary Fund.

The administration of President Hassan Rouhani, who took power in late 2013, has brought inflation down sharply and helped banks to begin repairing their balance sheets. Bad or doubtful loans were 13.2 percent of total loans in March 2014, central bank data shows.

But a full recovery is expected to take years. Banks may need to raise billions of dollars of fresh capital through sukuk or equity sales to take on substantial new business.

Another source of risk is the banking system's ties to the government. There are three state-owned commercial banks and five specialised government banks; although Rouhani has declared he wants the private sector to play a bigger role in the economy, many of the 19 banks classified as private have close ties to state institutions and operate under their influence.

ISLAMIC FINANCE

In 1983, Iran passed legislation converting its entire banking system into an Islamic one. But it is a unique form of sharia-compliant banking.

Although Islamic finance is interpreted by scholars around the world to ban the payment of interest, Iranian banks can still effectively use interest-based transactions and retain the accounting standards of conventional banking, according to a study by Pakistan's central bank.

"All these features indicate Islamic banking in Iran (is) significantly different from the basic features of Islamic banking in other regions of the world," the study found.

While the standards of the Bahrain-based Accounting and Auditing Organisation for Islamic Financial Institutions (AAOIFI) are widely followed around the world, they are not enforced in Iran.

Trading of Islamic bonds using the salam format, a deferred sale contract, was disallowed by AAOIFI in 2007, for example. But in Iran's debt market, salam is a common form of sukuk.

Such differences may make it hard for Islamic as well as conventional banks to establish ties with Iran's banks and do business there, at least initially. The sharia boards of Gulf banks would balk at deals with Iranian institutions that were seen to be un-Islamic.

"Major issues are the trading of debt and use of derivatives - these are two very complicated issues in any Islamic financial system, and in Iran we have very different approaches," said one Iranian banker.

There are signs that Iran is starting to develop new channels that would ease contacts with foreign banks, however. An official of the capital market regulator, the Securities and Exchange Organisation, said last month that it was seeking to develop alternative sukuk products.

"The sharia committee in SEO is working hard to adjust these contracts as well as developing new sharia-compliant contracts," Majid Zamani, chief executive of Tehran-based Kardan Investment Bank, told Reuters. (Editing by Andrew Torchia and Anna Willard)