FOX News host Bill O'Reilly will lose residential custody of his children following a New York appeals court ruling last week.
The Nassau County Supreme Court ruling upheld a lower-court decision that the kids, ages 13 and 17, should live with the FOX News Channel host's ex-wife, Maureen McPhilmy, according to court documents obtained by TheWrap.
"There is a sound and substantial basis for the Supreme Court's determination that it is in the best interests of the children for the mother to be awarded primary residential custody," the ruling says.
The judgment awards full-time custody to McPhilmy, while granting O'Reilly a share of legal custody, allowing him equal say in material matters concerning the children.
O'Reilly's "The O'Reilly Factor" is the most-watched show on cable news.
See more of O'Reilly through the years:
Bill O'Reilly loses custody of kids in unanimous court ruling
WASHINGTON, DC - FEBRUARY 27: Bill O'Reilly, host of FOX News Channel's The O'Reilly Factor, waits for the arrival of U.S. President Barack Obama during an event about Obama's 'My Brother's Keeper' initiative in the East Room at the White House February 27, 2014 in Washington, DC. As part of his 'Year of Action,' Obama announced a $200 million commitment from nine foundations to bolster the education and employment of young men and boys of color. (Photo by Chip Somodevilla/Getty Images)
THE TONIGHT SHOW STARRING JIMMY FALLON -- Episode 0170 -- Pictured: Author Bill O'Reilly on November 25, 2014 -- (Photo by: Douglas Gorenstein/NBC/NBCU Photo Bank via Getty Images)
NEW YORK, NY - JUNE 18: TV Personality Bill O'Reilly attends An Evening with Bill O'Reilly and Geraldo Rivera at 92nd Street Y on June 18, 2014 in New York City. (Photo by Mark Sagliocco/FilmMagic)
NEW YORK, NY - DECEMBER 04: Donald Trump and Bill O'Reilly attend the game between the New York Knicks and the Cleveland Cavaliers at Madison Square Garden on November 30, 2014 in New York City.NOTE TO USER: User expressly acknowledges and agrees that, by downloading and/or using this photograph, user is consenting to the terms and conditions of the Getty Images License Agreement. (Photo by Elsa/Getty Images)
NEW YORK, NY - JUNE 18: (L-R) TV Personalites Geraldo Rivera and Bill O'Reilly attend An Evening with Bill O'Reilly and Geraldo Rivera at 92nd Street Y on June 18, 2014 in New York City. (Photo by Mark Sagliocco/FilmMagic)
TODAY -- Pictured: Bill O'Reilly appears on NBC News' 'Today' show -- (Photo by: Peter Kramer/NBC/NBC NewsWire via Getty Images)
NEW YORK, NY - OCTOBER 16: Bill O'Reilly attends the 11th annual Giants of Broadcasting Honors at Gotham Hall on October 16, 2013 in New York City. (Photo by Noam Galai/WireImage)
THE VIEW - (10.1.13) Today's guest co-host is Jason Biggs ('Orange is the New Black.') Guests include Bill OReilly (author, Killing Jesus); Matt Long and Lorraine Bruce (ABC's 'Lucky 7') on ABC's 'The View.' 'The View' airs Monday-Friday (11:00 am-12:00 pm, ET) on the ABC Television Network.
(Photo by Fred Lee/ABC via Getty Images)
BARBARA WALTERS, BILL O'REILLY
Regis Philbin talks with Bill O'Reilly, of the O'Reilly Report, during the Court TV celebration of it's 10th anniversary at American Park inside Battery Park in New York City on July 18, 2001. photo by Gabe Palacio/ImageDirect
Bill O'Reilly attends the benefit for Homeless Children on November 16, 1989 at Letizia Restaurant in New York City. (Photo by Ron Galella, Ltd./WireImage)