* PT, Telefonica in joint agreement to sell stakes
* Each gets 400 million euros, PT net gain 270 million euros
* Deal seen closing by end-2009
(Recasts, adds PT CEO, stock prices)
By Elisabete Tavares
LISBON, Sept 1 (Reuters) - A group of Moroccan companies has agreed to buy the 32.2 percent stakes held by Portugal Telecom and Spain's Telefonica in Morocco's No.2 telecoms firm Meditel for 400 million euros ($574 million).
Portugal Telecom said in a statement on Tuesday the buyers were Moroccan insurance company RMA Watanya, privately owned group FinanceCom and Fipar Holding, a unit of CDG fund, which is the government's financing arm.
RMA Watanya and FinanceCom are owned by Othman Benjelloun, who already holds 5 percent of Meditel.
Telefonica later confirmed the joint agreement to sell for the same amount as PT. The deal, which gives control of the company to the Moroccan firms, is expected to close by the end of 2009 once regulatory approval has been obtained, Telefonica said.
PT Chief Executive Officer Zeinal Bava told Reuters his company would make a capital gain of 270 million euros ($387.7 million) after tax and said the proceeds would strengthen its balance sheet and financial flexibility, and it remained committed to international development.
"Whilst Morocco has great potential for future growth and Meditel is a reference mobile operator, we are focused on developing our businesses in Brazil and sub-Saharan Africa," Bava said.
In Brazil, PT and Telefonica jointly own Vivo, the No. 1 mobile phone company in Latin America's largest country. PT also has stakes in telecom companies in Angola and Namibia.
Bava said the sale had raised significant market interest.
"We are highly impressed by the quality of all the bidders," he added.
Qatar Telecommunications Co (Qtel) had said earlier it was interested in PT's plans to sell its stake in Meditel.
When the possibility of the stake sale by PT was first reported in May, analysts said its share was worth between 300 million to 400 million euros.
PT stocks rose 1.6 percent in early trading to 7.327 euros, outperforming the broader market in Lisbon, which was up 0.3 percent. Telefonica shares were up just 0.2 percent at 17.625 euros. (Reporting by Elisabete Tavares and Andrei Khalip; Additional reporting by Judy MacInnes; Editing by David Holmes/Will Waterman) ($1=.6964 Euro)