Shipping-to-oil group A.P. Møller-Maersk is to sell most of its shares in Dansk Supermarked, the retailer with over 1,300 stores in Denmark, Germany, Poland and Sweden.

Maersk has agreed a deal to sell back a 49% stake in Dansk to the Salling Companies, its partner in the retail business and a group linked to the grocer's founder. The transaction will see Maersk receive DKK17bn (US$3.1bn).

The conglomerate will keep a 19% stake in Dansk on which Salling has a call option it can activate in five years.

Maersk CEO Nils Andersen is looking to focus the group on other sectors. He said "the time is right" for the sale.

"Over the last two years Dansk Supermarked has undergone a rejuvenation and has a strong future ahead of it," Andersen said.

Dansk Supermarked runs stores under four banners in Denmark - Netto, Fotex, Bilka and Salling. It also has Netto stores in Germany, Poland and Sweden.

In 2012, the last full year for which figures are available, Dansk Supermarked reported EBITDA of DKK2.51bn, down from DKK2.89bn in 2011. Sales in 2012 were DKK55.61bn, compared to DKK55.23bn a year earlier.

For the first nine months of 2013, EBITDA was DKK2bn, while sales were DKK41.76bn.