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
Fox News commentator Bill O'Reilly appears on the Fox News show, "The O'Reilly Factor," on Jan. 18, 2007 in New York. After eating dinner at a famed Harlem restaurant recently, O'Reilly started a controversy after he told a radio audience he "couldn't get over the fact" that there was no difference between the black-run Sylvia's and any other restaurant in New York. (AP Photo/Jeff Christensen)
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)
FILE - In this Oct. 28, 2013 file photo, political commentator Bill O'Reilly attends the National Geographic Channel's "Killing Kennedy" world premiere screening reception at The Newseum, in Washington. O'Reilly and Stephen Colbert of "The Colbert Report," is mocking the Fox News Channel host's proposal that a 25,000-member mercenary force be armed and trained to fight the Islamic state. Colbert countered with his own "army of expert double Ninja super soldiers with laser nunchucks," imagined when he was in the fourth grade. (Photo by Paul Morigi/Invision/AP, File)
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
FILE - This Sept. 22, 2010 file photo shows Comedy Central's Jon Stewart from "The Daily Show with Jon Stewart," left, and and political pundit Bill O'Reilly during an interview for "The O'Reilly Factor" on FOX News Channel, in New York. O'Reilly and Jon Stewart face off for a special 90-minute debate about the 2012 presidential race. The live debate will be streamed online on Oct. 6, 2012 from George Washington University in Washington, D.C. The price is $4.95, with one-half of the profits donated to a number of unspecified charities. (AP Photo/Peter Kramer, file)
Comedy Central's Jon Stewart, left, and Bill O'Reilly tape an interview to be presented tonight on The O'Reilly Factor on FOX News Channel, in New York, on Wednesday, Sept. 22, 2010. (AP Photo/Peter Kramer)
Bill O'Reilly is shown during a taping for Fox News channel's "The O'Reilly Factor," in New York, Monday, Nov. 16, 2009. (AP Photo/Kathy Willens)
**FILE** Fox News host Bill O'Reilly poses on the roof of the Fox building in New York in this Oct. 13, 2003, file photo. An abortion doctor plans to ask for an investigation of O'Reilly and the Kansas attorney general over comments by the television host that he got information from Kansas abortion records, the doctor's attorneys said Saturday, Nov. 4, 2006. (AP Photo/Jim Copper)
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 poses prior to the taping of his talk show, "The O'Reilly Factor," at a Fox News Channel studio in New York, Oct. 25, 2000. His combatative style has garnered the blunt-talking O'Reilly high ratings in recent months. (Photo by Gino Domenico)
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)