President Donald Trump made his most extensive attack on the media since taking office Thursday while seeking to defend his administration from critical coverage.

In a press conference that lasted more than an hour, Trump repeatedly accused journalists of being hostile and dishonest in their reporting on his first month in office.

"The press has become so dishonest that if we don't talk about, we are doing a tremendous disservice to the American people. Tremendous disservice," Trump said. "We have to talk to find out what's going on, because the press honestly is out of control. The level of dishonesty is out of control."

"I turn on the T.V., open the newspapers and I see stories of chaos. Chaos," he said. "Yet it is the exact opposite. This administration is running like a fine- tuned machine, despite the fact that I can't get my cabinet approved."

The press conference, which was nominally intended to announced Trump's pick for labor secretary, was the president's idea. A senior administration official told CNN that Trump walked into the Oval Office Thursday morning and told his top aides: "Let's do a press conference today."

Related: An amazing moment in history: Donald Trump's press conference

During his remarks, Trump made several statements about the media that were either untrue or misleading. He claimed reporters at The New York Times and The Wall Street Journal did not reach out to him before writing certain stories. Both stories he cited note that the reporters tried to get comment from the White House.

The president also called recent stories about his campaign advisers' communications with Russia "fake news" and repeatedly said the New York Times was "failing."

"Russia is fake news," the president said. He went on to say "I've never seen more dishonest media than, frankly, the political media."

At one point, Trump was asked how the stories he condemned as "fake news" could in fact be fake if they were based on leaks he was slamming as illegal.

"Well the leaks are real," he said. "You're the one that wrote about them and reported them, I mean the leaks are real. You know what they said, you saw it and the leaks are absolutely real. The news is fake because so much of the news is fake."

In a lengthy exchange with CNN's Jim Acosta, Trump said he wanted to "turn in CNN for not doing a good job," and that the reporting "is fake." He also claimed he no longer watches CNN, but complained about what he sees when he watches the network.

Trump also complained about the tone of the media's coverage: "The tone is such hatred," he told Acosta. "I'm really not a bad person, by the way. No, but the tone is such -- I do get good ratings; you have to admit that. The tone is such hatred."

He then went on to promote one news show -- "Fox & Friends," the Fox News morning show on which he used to have a regular interview slot and which has been largely favorable to Trump since he was elected -- as an example of honest news.

"I have to say, "Fox & Friends" in the morning, they're very honorable people," he said. "They're very -- not because they're good, because they hit me also when I do something wrong. But they have the most honest morning show. That's all I can say. It's the most honest."

The bulk of Trump's remarks centered on defending his performance as president. "I inherited a mess," Trump said three times before listing his achievements, including pledges from companies to hire more American workers.

"Unfortunately, much of the media in Washington, D.C., along with New York, Los Angeles in particular, speaks not for the people, but for the special interests and for those profiting off a very, very obviously broken system," Trump said.

The president had been criticized recently for ignoring questioners from the mainstream media when holding his news conferences with foreign leaders. On Thursday, he took questions from more than a dozen reporters with mainstream outlets, including NPR, NBC, ABC, CBS and CNN, among others.

At one point, Trump even suggested that he would like to have a better relationship with the press, but said he could not do so so long as the coverage was "fake."

"I can handle a bad story better than anybody, as long as it's true," the president said. "But I'm not OK when it's fake."

Trump also specifically attacked leaks to the press, and outlets who run information based on leaks.

"How does the press get this information that's classified? How do they do it?" he asked. "[I]t's an illegal process and the press should be ashamed of themselves. But more importantly, the people that gave out the information to the press should be ashamed of themselves, really ashamed."