Updated

Megyn Kelly offered a heartfelt tribute to Fox News and her viewers in explaining her "tough decision" to leave the network for NBC.

At the close of Tuesday's "Kelly File," Kelly said she felt a "human connection" to her viewers and also treasures that "particularly when it comes to my children, who are 7, 5 and 3," signaling that her nighttime schedule was a key factor in her decision.

"I have grown up here and been given every chance a young reporter could ever ask for," she said, praising Rupert Murdoch's family for its kindness toward her. Her last show at Fox airs Friday.

Kelly's closing remarks came less than 12 hours after the surprise announcement that she will be giving up her prime-time role at Fox for a multi-year deal that includes several roles at NBC. She will launch a daytime program as well as a Sunday evening news magazine show, and be part of the network’s coverage of major political and breaking-news events.

Murdoch, executive chairman of 21st Century Fox, said in a statement: “We thank Megyn Kelly for her 12 years of contributions to FOX News. We hope she enjoys tremendous success in her career and wish her and her family all the best.”

Kelly told viewers she deeply admires the journalists at NBC, but also said she is "very grateful" to Fox for her 12-year career at the news channel. She expressed similar sentiments in a Facebook posting, singling out not just Murdoch but his sons, Lachlan and James, who led the discussions to keep her.

The anchor made one wry reference to her critics, saying she even values those who "very rarely complain" about her on Twitter after a show or a presidential debate--an apparent reference to the Donald Trump supporters who turned on her during the campaign.

Fox News fought hard to keep Kelly, who became a breakout star and whose 9 p.m. show was the second-highest rated in cable news, behind the “O’Reilly Factor.” Trump’s attacks on Kelly during the campaign helped turn her into an international celebrity and she was featured on the cover of the New York Times Magazine, Vanity Fair and other publications. She also just published a best-selling memoir, “Settle for More.”

Kelly’s contract at Fox was not due to expire for another six months.

Money did not appear to be the major factor in her decision; Kelly stood to make an eight-figure salary wherever she went. As she talked about her thinking, it became clear that a top priority was a schedule that would allow her to spend more time with her three young children rather than returning home after their bedtime.

Fox News now faces the challenge of replacing Kelly in prime time, as well as at such major events as debates and political conventions, where she has generally appeared alongside Bret Baier and Chris Wallace.

Kelly was an increasingly unhappy lawyer in 2004 when she parlayed a part-time gig at a Washington station into a reporting job at Fox. She quickly rose through the ranks, co-anchoring “America’s Newsroom” with Bill Hemmer and then hosting a 1 p.m. show before the move to prime time.

NBC Universal Chairman Andrew Lack said in a statement, “Megyn is an exceptional journalist and news anchor, who has had an extraordinary career” Lack said. “She’s demonstrated tremendous skill and poise, and we’re lucky to have her.”

The move gives Kelly access to the potentially larger audience of a major broadcast network. But launching a daytime program can be difficult, even for famous journalists.

Katie Couric, the former “Today” co-host and CBS anchor, lasted two years in an ABC-backed daytime show whose first executive producer was Jeff Zucker, now CNN’s president. CNN anchor Anderson Cooper also lasted two seasons in daytime. The largely female audience tends to favor entertainment and lighter fare over serious news topics. NBC did not announce a time for Kelly’s new show.

Trump’s sharp criticism of Kelly after the first presidential debate, when she asked him about his demeaning comments toward some women, brought her a torrent of online abuse and, she disclosed in her book, her family was forced to use security guards. The two buried the hatchet in an interview that aired on the Fox broadcast network.