Kelsey and Camille Grammer have settled their bitter child custody battle.

The sparring ex-spouses have reached an agreement in which their two kids – son Jude, 7, and daughter Mason, 10 – will stay together and continue living with Camille in Los Angeles, a source with knowledge of the case told the Daily News.

Kelsey will have “meaningful” visitation, the source confirmed.

“The settlement is permanent and final. They will move on, and hopefully it’s all good,” another insider close to the agreement told The News.

Both sides also are nearing a definitive financial settlement, the last outstanding in the case, the source said.

The former “Frasier” star, 56, previously suggested splitting the kids up, with Jude going to live with Kelsey in Chicago, an April 2011 letter obtained by revealed.

Read more: