Ikea has agreed to pay $50 million to the families of three toddlers who were killed when Ikea dressers tipped over on them.

The settlement was announced by the families' lawyers. The money will be split evenly among the families of Curren Collas of West Chester, Pennsylvania, Camden Ellis of Snohomish, Washington, and Ted McGee of Apple Valley, Minnesota. All three boys were 2 years old when they died.

The settlement was reached after a two-day hearing before a retired federal judge. In addition to the $50 million, Ikea will donate $50,000 to three children's hospitals in the families' home states, and $100,000 to Shane's Foundation, a child safety charity.

Ikea also agreed to only sell chests and dressers in the United States that meet or exceed the national voluntary safety standard.

Related: Ikea to recall dressers after death of third child

Ikea announced a repair program in July 2015 to encourage customers to anchor the dressers to the wall. After the third death, it announced a recall of millions of the dressers, along with a refund program for customers who returned them.

The recall included Malm chests and dressers with three, four, five and six drawers, as well as children's chests and dressers taller than 23.5 inches and adult pieces taller than 29.5 inches. All three boys were killed when Malm dressers tipped over on them.

Ikea confirmed the settlement but said it had no further comment.