* Q2 net profit 217 mln euros versus 109 mln euros consensus
* Core capital ratio strong at 12.9 percent
* Messina says bank wants to stay in Hungary despite problems
* Loan loss provisions remain high (Adds analyst comment, details)
MILAN, Aug 1 Italy's biggest retail bank, Intesa Sanpaolo, beat analysts' forecasts with a second-quarter net profit of 217 million euros ($291 million), helped by its strategic shift towards asset management.
Intesa's net profit in the three months from April to June compared with 116 million euros a year ago and a Thomson Reuters consensus forecast of 109 million euros.
The bank said its operating result and pre-tax profit for the period were the best in the last nine quarters, with higher revenues from asset management and capital gains from stake sales offsetting the impact of one-off charges such as higher taxes.
At 3.3 billion euros, asset management commissions in the first half of the year were up 9 percent from a year earlier and were the highest since 2007.
Results were affected by a number of one-off items. On the negative side, Intesa had to pay some 440 million euros in additional taxes on the revaluation of its 40 percent stake in the Bank of Italy.
It also took a 65 million euro charge in the second quarter because of new legislation in Hungary requiring banks to compensate customers for exchange rate spreads applied on foreign currency loans - the latest setback for the country's mostly foreign-owned lenders.
On the positive side, it booked capital gains of 220 million euros from the sale of stakes in payment services group SIA and hotel chain NH Hoteles.
Intesa's CEO Carlo Messina could not say whether Hungarian measures aimed at protecting borrowers could result in further charges, but said Intesa considered its operations in the country strategic and wanted to stay there.
The group's provisions for loan losses remained high at 1.18 billion euros, as its home market Italy struggles to emerge from its longest recession since World War II.
Like other European lenders, Intesa is shedding non-core assets to boost its capital base, which is already one of the strongest in Italy, in preparation for a Europe-wide health check of lenders to be completed later this year.
"We are confident that we will emerge as winners from the comprehensive assessment," Messina told analysts in a conference call.
The Common Equity Tier 1 ratio, a measure of financial strength, stood at 12.9 percent, from 12.6 percent at the end of March.
Analysts said the results were above expectations on most counts, although bad loans grew 3 percent quarter-on-quarter, compared with a 1 percent increase in the first quarter.
"The...strategy based on asset management business is delivering, as the strong revenue performance is supported by net fees," said Carlo Tommaselli of Societe Generale.
"The only slightly disappointing data was asset quality, worsening a bit more than expected."
The shares were trading 2.5 percent higher by 1446 GMT at 2.2860 euros.
($1 = 0.7465 Euros) (Reporting by Silvia Aloisi; Editing by Elaine Hardcastle)