Spain's Telefonica SA (TEF) and Portugal Telecom SGPS SA (PT) Tuesday agreed to sell their stakes in Morocco's Medi Telecom SA for a total of EUR800 million, as they seek to focus on core markets in Europe, Latin America and sub-Saharan Africa.

Telefonica and Portugal Telecom, which jointly operate Brazil's leading mobile phone provider Vivo Participacoes SA (VIV), will sell their respective 32.18% stakes to local Meditel shareholders FinanceCom SA, RMA Watanya SA and Fipar Holding, which jointly will pay EUR400 million to Telefonica and another EUR400 million to Portugal Telecom.

Portugal Telecom will book an after-tax capital gain of EUR270 million from the sale of its stake, a company press official said. Telefonica didn't disclose its own capital gain from the transaction.

Portugal Telecom said despite Meditel being a company with high growth potential, Portugal Telecom's strategic focus remains in Brazil and sub-Saharan Africa.

A Telefonica press official said the Spanish telecommunications giant wants to focus on core markets in Latin America, the U.K. and Spain.

"Telefonica considers that it is the appropriate time to crystallize the value created throughout this decade in Morocco," Telefonica said in a release. Both companies have been Meditel shareholders for more than 10 years.

The transaction values Meditel at EUR1.62 billion, including debt, Portugal Telecom said. No additional details were disclosed.

At 1445 GMT, Telefonica shares were up 0.7% at EUR17.70, while Portugal Telecom was up 1.7% at EUR7.33.

The transaction still requires clearance from Moroccan telecommunications regulators. Telefonica expects the transaction to be completed by the end of the year.

Company Web site: www.telefonica.com

-By Bernd Radowitz, Dow Jones Newswires, 34 913958120, djmadrid@dowjones.com