WASHINGTON— Matt Gaetz has withdrawn as Donald Trump ’s pick for attorney general, after it became clear Republican lawmakers were prepared to reject his nomination amid swirling sexual misconduct and drug allegations.

“It is clear that my confirmation was unfairly becoming a distraction to the critical work of the Trump/Vance Transition,” Gaetz said in a post on X. “There is no time to waste on a needlessly protracted Washington scuffle, thus I’ll be withdrawing my name from consideration to serve as Attorney General.”

The move marks the biggest political blow for Trump since his election to a second presidential term. His selection of Gaetz, a longtime ally and fierce Justice Department critic, startled lawmakers and members of the conservative legal community. It also sparked immediate objections from senators of both parties, raising doubts about whether he could be confirmed.

In a statement on Truth Social, Trump said Gaetz “was doing very well but, at the same time, did not want to be a distraction for the Administration, for which he has much respect. Matt has a wonderful future, and I look forward to watching all of the great things he will do!”

Gaetz resigned from Congress last week on the day Trump announced him as the attorney general nominee.

The former lawmaker, who represented a district in the Florida Panhandle, had been under the cloud of a long-running investigation by the House Ethics Committee into allegations that he used illicit drugs and had sex with a minor while he was in office. The committee had been prepared to make its report public, but Gaetz’s departure blocked its release as he was no longer under the panel’s jurisdiction.

The panel  deadlocked Wednesday  on whether to release it anyway and will meet again in early December.

Gaetz was on Capitol Hill Wednesday to meet one-on-one with senators in a bid to salvage his nomination.

Sen. Cynthia Lummis (R., Wyo.) on Thursday said Gaetz “must have gotten some signals” during his meetings with senators about the hurdles ahead. Asked about Gaetz’s withdrawal, Sen. Roger Wicker (R. Miss.) gave a prolonged and silent smile.

Bringing the historically independent Justice Department under closer presidential control has been a priority for Trump. That would be a stark break from the traditional arm’s-length relationship between the White House and attorney general, who has historically shielded investigations from political influence.

Trump has for years clashed with the department as it investigated him and his allies, and often expressed regret over his attorney general choices in his first term, Jeff Sessions and William Barr , who resisted some of his most extreme demands. He has been searching for an attorney general who would be more willing to do his bidding as he has threatened to seek retribution against his political rivals.

Gaetz, 42, had been well-situated to carry out that agenda. From his former perch on the House Judiciary Committee, he argued the department under the Biden administration targeted Trump for political reasons, and he has expressed sympathy with rioters who stormed the Capitol on Jan. 6, 2021, as lawmakers were certifying Joe Biden ’s presidential win.

Gaetz has called the Justice Department “corrupt and highly political,” and said the agency shouldn’t be “some unelected 4th branch of government, aloof to the administration’s vision and direction.”

The department had investigated whether Gaetz engaged in sex-trafficking a minor, a probe that began during Trump’s first term and ended last year without criminal charges. The former lawmaker denied wrongdoing.

Trump’s selection of Gaetz stirred alarm inside the Justice Department. Career officials had been deeply worried by the prospect of his leadership, and some had begun seeking other jobs. Even some legal conservatives who had hoped for jobs in the Trump Justice Department were rethinking whether they wanted to join with Gaetz at the top.

A person familiar with Gaetz’s thinking said it was his decision alone to pull out.

“President Trump will announce his new decision when it is made,” Trump-Vance Transition spokeswoman Karoline Leavitt said.

Before Trump picked Gaetz, the Republican establishment believed the president-elect’s shortlist included Missouri Attorney General Andrew Bailey and Jay Clayton , former chairman of the Securities and Exchange Commission, whom Trump has since tapped to be U.S. Attorney for the Southern District of New York. Also in the running was Matt Whitaker , a former acting attorney general whom Trump instead has chosen to serve as U.S. ambassador to NATO.

Gaetz’s problems had been mounting by the day, as more details about the House investigation became public. One witness told the committee she saw Gaetz having sex with a 17-year-old girl at a party in 2017, a lawyer for the woman said Monday.