(Reuters) - Shepard Smith, the chief news anchor of Fox News and a sometime critic of U.S. President Donald Trump, abruptly quit the network on Friday after 23 years.

In an unexpected on-air statement at the end of his daily “Shepard Smith Reporting” show, Smith said he had asked to leave the conservative-leaning cable news network, which is the most-watched in the United States.

His farewell message ended with the hope that “the truth will always matter.”

“Recently I asked the company to allow me to leave Fox News. After requesting that I stay, they obliged. Under our agreement I won’t be reporting elsewhere, at least in the near future,” Smith said.

“Even in our currently polarized nation, it’s my hope that the facts will win the day, that the truth will always matter, that journalism and journalists will survive,” Smith said.

Smith, who was also managing editor of the network’s breaking news unit, has been one of the few senior journalists on Fox News to criticize Trump.

His departure follows attacks by Trump on the network’s less friendly coverage of his administration since the U.S. House of Representatives began an impeachment inquiry, which opinion polls suggest has growing support from Americans.

A person walks by the Fox News offices after it was announced that news anchor Shepard Smith had quit the network in New York City, U.S.,October 11, 2019. REUTERS/Andrew Kelly

The New York Times reported earlier on Friday that U.S. Attorney General William Barr met this week with Rupert Murdoch, whose Fox Corp owns Fox News.

“FoxNews doesn’t deliver for US anymore. It is so different than it used to be. Oh well, I’m President!,” Trump tweeted on Thursday.

In March, Smith took issue with Trump’s criticism of the late Republican Senator John McCain, and in August Smith spoke out about the “unmistakable rise of white nationalism and white racism in America” which Democrats say Trump has not done enough to discourage.

In September, Smith called out Trump for his mistaken insistence that the state of Alabama was in the path of Hurricane Dorian.

Trump, who has repeatedly criticized the U.S. media as “the enemy of the people,” has lashed out publicly against Shepard.

“Watching Fake News CNN is better than watching Shepard Smith, the lowest rated show on @FoxNews,” Trump tweeted in August.

Smith has been with Fox News since it was launched in 1996 and his departure took colleagues by surprise.

“Shepard Smith just dropped a bomb ... He was part of the glue that held Fox together. He is a supreme pro who made us all better,” Fox News chief White House correspondent John Roberts tweeted on Friday.

Fox News President Jay Wallace in a statement called Smith “one of the premier newscasters of his generation.”

“While this day is especially difficult as his former producer, we respect his decision and are deeply grateful for his immense contributions to the entire network,” Wallace said.