Merck had been seeking options for its consumer healthcare business for months

German pharmaceutical and chemicals group Merck said Thursday it had agreed to sell its consumer health business to American giant Procter & Gamble and would use the proceeds mostly to pay off debt.

As part of the 3.4-billion euro ($4.2 billion) cash deal, some 3,300 staff will move from Merck to Procter & Gamble, it said in a statement.

Merck had announced in September that it was looking at options for the consumer health business, including a possible sale.

On Thursday, Merck said it would use the net proceeds from the spinoff "primarily to accelerate deleveraging", but also to give its key businesses—, and performance materials—extra financial clout.

Procter & Gamble's CEO David Taylor, meanwhile, said his company liked "the steady, broad-based growth" of the over-the-counter healthcare market.

Merck said its consumer healthcare , which comprises more than 900 products sold in 44 countries, had outperformed the market's overall growth in the past three years.

The deal is to be completed by the end of the year.

Germany's Merck, founded in 1668, is the world's oldest chemical and pharmaceutical company. It employs 53,000 staff across the world and had sales last year of 25.3 billion euros.