US Attorney General Alberto Gonzales, embroiled in a row over the sacking of eight US attorneys, has formally announced his resignation.
In a brief news conference Mr Gonzales said he had met President George W Bush on Sunday to tender his resignation, which will take effect on 17 September.
Members of Congress have accused Mr Gonzales of abuse of office over the sacking of federal prosecutors.
He is the latest in a run of senior officials to leave the White House.
Paying tribute to Mr Gonzales, Mr Bush said on Monday that he had been subjected to “months of unfair treatment” and that “his good name was dragged through the mud for political reasons”.
Mr Gonzales had played a critical role in the war on terror and “worked tirelessly to keep this country safe,” the president said.
A long-time ally of Mr Bush, Mr Gonzales has worked with the president since his days as Texas governor and was the country’s first attorney general of Hispanic descent.
The BBC’s James Coomarasamy, in Washington, says Mr Gonzales has been one of the closest and most trusted advisors to Mr Bush for many years, but also one of the most controversial.
Q&A: Prosecutors row
The row over last year’s firings, which critics in Congress claimed were politically motivated, has been rumbling for months.
Mr Gonzales, the nation’s top law-enforcement officer, has faced numerous calls to resign over the affair.
Opponents say he fired the attorneys for political reasons and later lied about the reason for their dismissal.
He testified before committees in both houses of Congress, but senators later said he lied under oath.
Mr Gonzales has repeatedly said that he did nothing wrong.
In announcing his resignation, Mr Gonzales said: “It has been one of my greatest privileges to lead the Department of Justice.”
The son of poor immigrants, Mr Gonzales added that even his worst day as attorney general had been “better than my father’s best days”.
Guantanamo Bay detainees
Mr Gonzales drafted the rules governing Guantanamo Bay
As well as the sackings row, Mr Gonzales has also been criticised for helping to expand presidential powers in connection with the administration’s war on terror – from drafting the controversial rules governing prisoners at Guantanamo Bay to authorising a secret phone tapping programme
He was censured by some human rights groups after writing a memo to the president in which he said the war against terror was a “new kind of war” that renders obsolete Geneva’s strict limitations on questioning of enemy prisoners and renders “quaint” some of its provisions.
The memo came to light after the Abu Ghraib prison abuse scandal in Iraq.
Mr Gonzales stuck to his views, although he also made it clear that he did not approve of torture.
Opponents accuse him of bringing about the erosion of civil liberties.
Mr Bush is said to have reluctantly accepted his resignation when it was tendered on Friday, our correspondent says.
Mr Gonzales is the latest senior official to leave the White House as the president approaches the end of his second term in office.
Karl Rove, Mr Bush’s most trusted and senior adviser, announced earlier this month that he was stepping down.
Paul Wolfowitz, president of the World Bank, agreed in May to step down amid a row over the hiring of his girlfriend.
Donald Rumsfeld, one of the lead architects of the Iraq war, quit as defence secretary after a Republican battering at the polls in November’s mid-term election.