US Secret Service director Kim Cheatle has resigned after security failures surrounding an assassination attempt on former President Donald Trump.
"As your director, I take full responsibility for the security lapse," Ms Cheatle said in a resignation letter to agency staff.
She had faced calls from both Democrats and Republicans to step down after a contentious congressional hearing on Monday about the shooting.
Lawmakers became increasingly frustrated when she refused to answer questions about the shooting at Trump's campaign rally in Butler, Pennsylvania, earlier this month.
In Tuesday's resignation letter, Ms Cheatle said she had always "put the needs of the agency first" and it was “with a heavy heart” that she made her decision.
“The scrutiny over the last week has been intense and will continue to remain as our operational tempo increases,” she said.
“I do not want my calls for resignation to be a distraction from the great work each and every one of you do towards our vital mission.”
President Joe Biden said in a statement that he was grateful for her decades of public service.
"The independent review to get to the bottom of what happened on July 13 continues, and I look forward to assessing its conclusions. We all know what happened that day can never happen again," he said.
Mr Biden said he would appoint a new director soon.
For now, Secretary of Homeland Security Alejandro Mayorkas has appointed Ronald Rowe as acting director of the agency.
Mr Rowe, a 24-year Secret Service veteran, has held the position of deputy director since April 2023.
The president appointed Ms Cheatle to head the Secret Service - which oversees the protection of current and former presidents and other officials - in 2022. She had previously served 27 years at the agency in various roles.
During her time as an agent, Ms Cheatle was involved in evacuating then Vice-President Dick Cheney from the White House during the 11 September 2001 attacks.
She later went on to become supervisor of Mr Biden’s protective detail when he was vice-president, before she became the deputy assistant director of protective operations.
But her leadership came under question after the shooting at Trump's 13 July rally, where a bullet grazed the former president's ear.
The attack left one audience member dead and two others badly wounded.
Lawmakers questioned Ms Cheatle about security preparations ahead of the campaign rally during the six-hour House of Representatives Oversight Committee hearing.
Ms Cheatle took responsibility for the security lapses, but pushed back on calls to resign.
She called the shooting "the most significant operational failure at the Secret Service in decades".
Witnesses reported seeing a suspicious man - suspect Thomas Matthew Crooks - with a rifle on a rooftop at the rally minutes before shots were fired.
Crooks was killed by a counter-sniper shortly afterwards.
Security and law enforcement officers from a number of different agencies were present at the rally.
During her testimony, Ms Cheatle didn't offer lawmakers any new information on how Crooks was able to access the roof where he was perched and why Trump was allowed to take the stage.
After the hearing, the leading Republican and Democrat from the committee - James Comer and Jamie Raskin - sent a letter to Ms Cheatle that laid out their belief that she should step down.
Mr Comer said Ms Cheatle “instilled no confidence” during the hearing that she can fulfill the Secret Service’s protective mission.
“The Oversight Committee’s hearing resulted in Director Cheatle’s resignation and there will be more accountability to come,” he said in a statement posted on X, formerly Twitter.
In a post on his social media platform on Tuesday, Trump said: "The Biden/Harris Administration did not properly protect me, and I was forced to take a bullet for Democracy."
Republican House Speaker Mike Johnson called her resignation “overdue” and said he was "glad she did the right thing".
"Now we have to pick up the pieces, we have to rebuild the American people's faith and trust in the Secret Service," he told reporters.
Teresa Wilson, an ex-marine who attended the rally, told the OceanNewsUK that she was "glad [Ms Cheatle] succumbed to the pressure".
"I hope they still follow through with the independent investigation now that she's resigned. We want answers," she said.
In a separate hearing on Capitol Hill on Tuesday, Pennsylvania State Police Commissioner Christopher Paris detailed a number of security mistakes ahead of the shooting,
According to Mr Paris, two officers on a vantage point above the roof from where Thomas Matthew Crooks was shooting left their post to help investigate reports of a suspicious person.
Later, a police officer confronted Crooks on the roof just a few seconds before he opened fire on Trump.
While acknowledging "critical failures" at the Butler rally, he said the Secret Service "ultimately is responsible and is the final arbiter of any security matters affecting their protectee and the public".