DUBAI - Commercial Bank of Qatar(CBQ), the Gulf Arab state's third-largest lender by assets, swung to a third-quarter net profit on Wednesday but missed analysts' average forecasts.

CBQ reported net profit of 79.4 million riyals ($21.8 million) in the three months to Sept. 30. That compares with a net loss of 1.0 million riyals in the same period a year earlier.

The average of three analysts polled by Reuters had forecast CBQ would make a quarterly profit of 88.5 million riyals.

The third-quarter represents the first full financial quarter since a diplomatic rift began in June between Qatar and Saudi Arabia, the United Arab Emirates, Bahrain and Egypt.

Qatar National Bank, the Gulf's largest bank, last week reported a 5.6 percent rise in third-quarter, while Masraf Al Rayan reported a 6.5 percent increase in third-quarter net profit.

In the third quarter, impairments on bad loans eased 3 percent to 489.3 billion riyals compared to the same period of last year. CBQ's bad loan provisions have been rising as chief executive Joseph Abraham seeks to clean up the lender's balance sheet.

"We continue to provide for our legacy loan book and will do so for the remainder of 2017 before normalising the cost of risk in 2018," Abraham said in the earnings' statement.

CBQ's net interest income rose 7.9 percent and net fee and commission income rose 6.8 percent.

Qatar's row with its neighbours has cut off many of its banks' funding sources in the Gulf and has led to an outflow of deposits from those four countries.

CBQ's deposits slipped by 1.5 percent from the previous quarter to 73.3 billion riyals.

The bank may raise money via the Taiwanese bond market as it looks to diversify its funding sources, Abraham told Reuters last month.

CBQ last year raised its stake in Turkey's Alternatifbank to 100 percent and also holds shares in National Bank of Oman and United Arab Bank.

CBQ is in talks to sell its 40 percent stake in Abu Dhabi-listed UAB to United Arab Emirates-based Tabarak Investment, sources told Reuters on Sept. 27.

In Wednesday's statement, Abraham said the capital from the potential sale would be reallocated in line with its growth plan.

($1 = 3.6415 Qatar riyals)

(Editing by Jane Merriman) ((Tom.Arnold@thomsonreuters.com; +97144536265; Reuters Messaging: tom.arnold.thomsonreuters.com@reuters.net))