WACO, Tex., Aug. 27 — Attorney General Alberto R. Gonzales, whose tenure has been marred by controversy and accusations of perjury before Congress, announced his resignation in Washington today, declaring that he had “lived the American dream” by being able to lead the Justice Department.

Mr. Gonzales, who had rebuffed calls for his resignation for months, submitted it to President Bush by telephone on Friday, a senior administration official said. There had been rumblings over the weekend that Mr. Gonzales’s departure was imminent, although the White House sought to quell the rumors.

Mr. Gonzales appeared cheerful and composed when he announced that he was stepping down effective Sept. 17. His very worst days on the job were “better than my father’s best days,” he said, alluding to his family’s hardscrabble past.

“Thank you, and God bless America,” Mr. Gonzales said, exiting without responding to questions.

In Waco, President Bush said he had accepted the resignation reluctantly. He praised his old friend as “a man of integrity, decency and principle” and complained of the “months of unfair treatment” that preceded the resignation.