New York (CNN Business) Kellogg is getting out of the cookie business to focus on snacks and cereal.

Ferrero will buy Kellogg's Keebler cookies, Famous Amos, Mother's, Murray's, Girl Scout cookies and fruit snacks brands for $1.3 billion. Ferrero makes Nutella, Tic Tacs and Ferrero Rocher chocolates among other confectioneries.

Kellogg K has been trying to sell off those brands since November . It said the brands weren't a good fit with the rest of the company's offerings, and the company had difficulty devoting the resources necessary to compete in the crowded cookie market.

Last year, the businesses Kellogg is selling to Ferrero brought in about $900 million in sales but only $75 million in operating profit.

"Divesting these great brands wasn't an easy decision," said Steve Cahillane, Kellogg's CEO, in a statement. "This divestiture is yet another action we have taken to reshape and focus our portfolio, which will lead to reduced complexity, more targeted investment, and better growth."

Read More