Attorney General Jeff Sessions said Thursday that he plans to stay in his job despite the president’s public assertion that he would not have nominated Sessions to the post had he known that he would recuse himself from the investigation into Russian meddling in the 2016 election.

At a news conference ostensibly meant to announce the takedown of an illicit online marketplace, Sessions said he had the “honor of serving as attorney general,” and he planned “to continue to do so as long as that is appropriate.” Asked how he could keep working, having apparently lost President Donald Trump’s confidence, Sessions responded: “We’re serving right now. The work we’re doing today is the kind of work that we intend to continue.

“I’m totally confident that we can continue to run this office in an effective way,” Sessions added.

On Wednesday, The New York Times published an article about an interview with Trump in which the president said he would not have appointed Sessions as attorney general had he known Sessions would recuse himself from the investigation into whether the Trump campaign coordinated with Russia to influence the 2016 election.

“Sessions should have never recused himself, and if he was going to recuse himself he should have told me before he took the job, and I would have picked somebody else,” Trump said, according to The New York Times.

Sessions’ recusal came after The Washington Post reported that he had met with Russia’s ambassador to the United States and had not disclosed the contacts when the matter came up at his congressional confirmation hearing. In The New York Times interview, Trump also criticized his attorney general for his responses to questions in that hearing, saying: “Jeff Sessions gave some bad answers. He gave some answers that were simple questions and should have been simple answers, but they weren’t.”

Trump said Sessions’ recusal was personally unfair to him as president.

“How do you take a job and then recuse yourself?” Trump said. “If he would have recused himself before the job, I would have said, ‘Thanks, Jeff, but I’m not going to take you.’ It’s extremely unfair — and that’s a mild word — to the president.”

Sessions has said he recused himself because of his involvement with the Trump presidential campaign. As a result, Rod J. Rosenstein, whom Trump appointed as deputy attorney general, took charge of the probe, although Rosenstein would later appoint former FBI Director Robert S. Mueller III as special counsel to oversee it.

Trump also criticized Rosenstein and Mueller in his New York Times interview, saying both men had conflicts in the Russia probe — Rosenstein because he recommended firing then-FBI Director James Comey, which could be part of Mueller’s investigation, and Mueller because he interviewed to replace Comey.

Sessions had been scheduled to hold a news conference on the takedown of the illicit internet marketplace AlphaBay before the news of Trump’s interview broke, though it was clear from the moment the event started that reporters would not be focused on that. When officials opened the floor to questions, Sessions was asked how seriously he had considered resigning.

“We in this Department of Justice will continue every single day to work hard to serve the national interest, and we wholeheartedly join in the priorities of President Trump,” he responded. He later asserted that his plan to continue in his role.

Rosenstein, too, said he was “proud” to be in the Justice Department, declining to address directly a question about Trump’s criticism about him and Baltimore, where he worked as U.S. attorney. Trump had noted that the city had “very few Republicans.”

Sessions was once thought to be one of Trump’s closest advisers. He was the first senator to endorse Trump at a time when few Republican lawmakers supported the candidate, and early in the president’s administration he seemed to have access to Trump whenever he wanted, an official said.

In public, Sessions wouldn’t shy from linking his department’s priorities with Trump’s. When he directed federal prosecutors across the country Tuesday to make immigration cases a higher priority, for example, he declared in no uncertain terms, “This is the Trump era.”

If Sessions were to resign or be fired, that could call into question the future of the special counsel investigation. According to federal regulations, the special counsel reports to the attorney general, though because Sessions is recused, Mueller reports to Rosenstein. Were Sessions to be replaced at the top, Mueller would be overseen by his successor, who Trump would pick but who would require Senate confirmation. The attorney general can veto the special counsel’s decisions but is not supposed to offer day-to-day supervision.