– President Donald Trump on Thursday dismissed reports about his associates' contacts with Russia last year and vigorously defended his performance in his first four weeks in office in a contentious news conference that showcased his unconventional and unconstrained presidency.

At a hastily organized White House event ostensibly to announce a new nominee for labor secretary, Alexander Acosta, Trump engaged in an extended attack on the news media and insisted that his new administration was not a chaotic operation but a "fine-tuned machine." Any challenges, he said, were not his fault. "To be honest, I inherited a mess," he said.

In addition to his Cabinet announcement, the president revealed that he had asked the Justice Department to investigate government leaks and said he would sign an executive order next week restricting travel to the United States. He ­promised to produce by March a plan to repeal and replace the Affordable Care Act, followed by another plan to overhaul the tax system.

But his 77-minute news conference was dominated by an extraordinarily raw and angry defense of both his administration and character. At times abrupt, often rambling, characteristically boastful yet seemingly pained at the portrayals of him, Trump kept summoning the spirit of his successful campaign after a month of grinding governance to remind his audience, again, that he won.

For a president who has already lost a court battle, fired an acting attorney general and a national security adviser, and lost a Cabinet nomination fight, Trump was eager to demonstrate that he was still in command. He attacked judges for blocking his original travel order and Democrats for obstructing his nominations. He denied being anti-Semitic even when no one accused him of it. With the latest Pew Research Center poll showing that just 39 percent of Americans approve of the job he is doing, Trump at one point plaintively pleaded for understanding.

"The tone is such hatred," he said, referring to the commentary about him on cable television. "I'm really not a bad person."

Trump disputed any contention that the White House was out of control or not fully functional and boasted of a flurry of actions intended to create jobs, curb regulations and crack down on illegal immigration.

"There has never been a presidency that has done so much in such a short period of time," he said. "And we haven't even started the big work yet. That starts early next week."

The enactment of a temporary ban on refugees and all visitors from seven predominantly Muslim countries, he maintained, was "perfect," despite widespread confusion and subsequent court rulings blocking it. "We had a very smooth rollout of the travel ban," he said. "But we had a bad court."

Trump offered his first account of his decision to fire Michael Flynn, his national security adviser, for misleading Vice President Mike Pence and others in the White House about the contents of a conversation with Russia's ambassador in December.

He said he was not bothered that Flynn had talked with the ambassador about U.S. sanctions on Russia before arriving at the White House. "I didn't direct him," he said, "but I would have directed him because that's his job."

The problem, he said, was that Flynn had told Pence that sanctions did not come up during the conversation, an assertion belied by a transcript of the call, which had been monitored by U.S. intelligence agencies.

"The thing is he didn't tell our vice president properly and then he said he didn't remember," Trump said. "So either way, it wasn't very satisfactory to me."

But he said reports that his campaign aides and other associates had contacts with Russia were "a joke" and "fake news put out by the media." The New York Times reported this week that phone records and intercepted calls showed repeated contacts between some of his associates and Russian intelligence officials in the year before the election.

"Russia is a ruse," Trump said. "I have nothing to do with Russia. To the best of my knowledge, no person that I deal with does."

However, Trump said, all the pressure on Russia may ruin any future negotiations with President Vladimir Putin.

"Putin probably assumes that he can't make a deal with me anymore because politically it would be unpopular for a politician to make a deal," he said.

Like presidents before him, Trump was peeved at a series of leaks, including about Flynn's call and his own conversations with foreign leaders. In addition to requesting the Justice Department investigation, he confirmed that he might assign a New York billionaire, Stephen Feinberg, to conduct a broad review of the intelligence agencies.

Trump spent much of the conference berating reporters and their news organizations. Clearly exasperated by coverage of him, he said he did not watch CNN but then gave a detailed critique of one of its shows. He cited articles in the New York Times and Wall Street Journal that he called "fake," even harking back to one from last year's campaign.

"The press is out of control," he said. "The level of dishonesty is out of control."