David Duchovny and Tea Leoni are divorcing

Tea Leoni and David Duchovny attend the 2009 UNICEF Snowflake Ball at Cipriani 42nd Street on Dec. 2, 2009, in New York.

Andrew H. Walker/Getty Images for UNICEF

David Duchovny and Tea Leoni have split after 17 years of marriage.

The stars of "Californication" and the new CBS drama "Madame Secretary" are divorcing, according to reports.

A source confirmed the news to People and added that the pair have been separated for months.

TMZ reports that the divorce was filed in June and the actors settled all the terms themselves. An "irretrievable breakdown of the relationship" was cited as the reason for the split.

The two will have joint legal custody of their two children, son Kyd Miller, 12, and Madelaine West, 15, but Leoni will have primary physical custody. "The X-Files" actor will pay $8,000 a month in child support plus other expenses including summer camp, private school and college, as well as $40,000 a month in spousal support, according to TMZ.

Duchovny and Leoni married in 1997. They first separated in 2008, the same year he entered rehab for sex addiction, and then separated for a second time in 2011.