The US attorney general, William Barr, one of Donald Trump’s staunchest allies, has resigned just weeks after he contradicted the president by saying the justice department had uncovered no evidence of widespread voter fraud that could change the outcome of the 2020 election.Barr’s departure ends a tenure marked by brazen displays of fealty to a president whose political agenda he willingly advanced. Critics said Barr had turned the Department of Justice (DoJ) into an obedient servant of the White House, eroding its commitment to independence and the rule of law.Trump sought to play down tensions as he announced Barr’s resignation in a tweet on Monday, moments after members of the electoral college officially pushed Joe Biden over the 270-vote threshold to win the White House on Monday. The procedural step effectively ends Trump’s unprecedented bid to overturn the results of the 2020 presidential election based on false claims of widespread voter fraud that Barr concluded were meritless.“Just had a very nice meeting with attorney general Bill Barr at the White House,” the president said. “Our relationship has been a very good one, he has done an outstanding job! As per letter, Bill will be leaving just before Christmas to spend the holidays with his family…”In his resignation letter, released by Trump on Twitter, Barr was characteristically effusive of the president. He praised Trump’s resilience in the face of what the attorney general described as a “partisan onslaught” that aimed to undermine a duly elected president.“No tactic, no matter how abusive and deceitful, was out of bounds,” Barr wrote.“Your record is all the more historic because you accomplished it in the face of relentless, implacable resistance,” he continued, adding: “Few could have weathered these attacks, much less forge ahead with a positive program for the country.”Jeff Rosen, the deputy attorney general, who Trump called “an outstanding person”, will take over the role of acting attorney general and “highly respected” Richard Donoghue, an official in Rosen’s office, would become the deputy attorney general.Barr surprised many observers by telling the Associated Press in an interview published on 1 December that he disputed the idea, promulgated by the president and his re-election campaign, that there had been widespread fraud in the 2020 election.Trump has attempted to undermine Biden’s victory by pointing to routine, small-scale issues in an election – questions about signatures, envelopes and postal marks – as evidence of widespread fraud across the nation that cost him the election.Trump and some of his allies have also endorsed more bizarre sources of supposed fraud, such as tying Biden’s win to election software created in Venezuela “at the direction of Hugo Chávez” – the former Venezuelan president who died in 2013.“There’s been one assertion that would be systemic fraud and that would be the claim that machines were programmed essentially to skew the election results. And the DHS and DoJ have looked into that, and so far, we haven’t seen anything to substantiate that,” Barr said in the interview with the AP.Barr said some people were confusing the role of the federal criminal justice system and asking it to step in on allegations that should be made in civil lawsuits and reviewed by state or local officials, not the justice department.Barr added: “There’s a growing tendency to use the criminal justice system as sort of a default fix-all, and, people don’t like something – they want the Department of Justice to come in and ‘investigate’.”Those comments infuriated Trump and his supporters as they have tried – and failed – to find any meaningful way, via the courts, requested recounts, or pressure on officials, of overturning his defeat by Biden.Speculation about Barr’s future was rife from the moment his AP interview was published, as the most high-profile member of the administration flatly to contradict the president’s continuing arguments that he is the rightful winner.For months, Barr also kept a justice department investigation into Joe Biden’s son, Hunter Biden, from becoming public, despite calls from Republicans and the White House to launch an inquiry into the younger Biden’s business dealings, according to the Wall Street Journal. Hunter Biden, long a target of the president and his political allies, announced last week that his tax affairs were under investigation.In the weeks before the 2020 election, Trump publicly berated his attorney general for not prosecuting the president’s political enemies, among them his Democratic opponent and his predecessor, Barack Obama. In an October interview, Trump said Barr would be remembered as a “very sad, sad situation” if he did not indict Biden or Obama. Barr’s refusal to act, Trump warned then, could cost him the election.Trump announced in December 2018 that he was nominating Barr to become his next attorney general, replacing Jeff Sessions, a loyalist who angered the president when he stepped aside and allowed his deputy to appoint a special prosecutor to investigate Russia’s election interference.Barr, 70, had previously served as attorney general in the George Bush administration and was initially viewed by political veterans in Washington as a much-needed stabilizing force who would insulate the department from political attacks. Yet, assuming the post the post as the Russia investigation into allegations of collusion between the Trump 2016 election campaign and Russian operatives neared its denouement in early 2019, Barr quickly upended expectations by ferociously attacking the special counsel investigation that examined the ties between Russia and the Trump campaign.In his resignation letter, the attorney general said it was the “nadir” of what he believed was a partisan crusade against the president “was the effort to cripple, if not oust, your administration with frenzied and baseless accusations of collusion with Russia”.Critics have often accused Barr of showing more loyalty to the president than to the nation. In one such instance, Barr called a press conference last April and offered a misleading preview of Mueller’s report. He omitted the report’s detailed description of potential obstruction of justice by Trump and falsely claimed the White House had cooperated fully.This set the tone for Trump’s inaccurate trumpeting when the report itself came out, in restricted form, that he and his team had enjoyed “total exoneration” by Mueller – a blatant misinterpretation.And Barr’s protocol-smashing, partisan path continued from there, as he intervened in criminal cases brought against prominent individuals in Trump’s circle, such as Roger Stone and Michael Flynn.He also initiated an investigation of the origins of the Russia investigation itself, seen as a fundamental undermining of the work of Mueller and his team, an effort that continues. More