Media captionHillary Clinton: "What difference, at this point, does it make?"

Secretary of State Hillary Clinton has angrily defended her handling of the raid on a US consulate in Libya, in back-to-back hearings on Capitol Hill.

Mrs Clinton lashed out at a senator who accused the Obama administration of misleading the public.

She took responsibility for security failures that led to the 11 September attack but said she had not seen requests for more security beforehand.

It was her last appearance at Congress as America's top diplomat.

"Nobody is more committed to getting this right," Mrs Clinton told the Senate foreign relations committee.

"I am determined to leave the state department and our country safer, stronger and more secure," she added.

Emotional testimony

She was questioned about the raid on 11 September last year on the US consulate in Benghazi that left the US envoy to Libya, Christopher Stevens, and three other officials dead.

At the scene

By Kim GhattasBBC state department correspondent

Four months after the attack on Benghazi, Mrs Clinton has finally testified in an open hearing in Congress about what happened, how her department and the administration handed it, and how to move forward.

She will hope her long-awaited appearance before Congress will defuse some of the political acrimony that has engulfed the debate about Benghazi. Much was at stake in this hearing, not just for Mr Obama's foreign policy in his second term and how Republicans will interact with his administration, but also for Mrs Clinton herself. This is her last high-profile public appearance before she steps down in a couple of weeks.

The ambassador died of smoke inhalation when he was trapped in the burning consulate building, after armed men stormed the compound.

The assault triggered a major political row over who knew what and when.

The incident became an issue in the presidential campaign, and outrage in Congress led the US ambassador to the UN, Susan Rice, to withdraw from the race to succeed Mrs Clinton.

Last November, Ms Rice admitted releasing incorrect information after the Benghazi attack - she said on a Sunday chat show on 16 September that the attack had stemmed from an anti-US protest.

Ms Rice later said there had been no attempt to mislead the public, but Republicans were unconvinced.

At Wednesday's Senate hearing, Senator Ron Johnson, a Wisconsin Republican, said: "We were misled that there were supposedly protests and then something sprang out of that, an assault sprang out of that."

Mrs Clinton replied with a raised voice: "But with all due respect, the fact is we had four dead Americans - was it because of a protest, or was it because of guys out for a walk one night who decided they'd go kill some Americans."

Thumping the table four times, she added: "What difference, at this point, does it make? It is our job to figure out what happened and do everything we can to prevent it from ever happening again, senator."

Media playback is unsupported on your device

Media captionHillary Clinton said the US needed to 'figure out how to support emerging democracies in North Africa'

In another tense moment, Senator Rand Paul, a Kentucky Republican, said Mrs Clinton's acknowledgement that she had not read the cables from Libya seeking additional security ahead of the attack was "inexcusable".

"Had I been president at the time and I found that you did not read the cables," he said, "I would have relieved you of your post."

Mrs Clinton told the senators her department was implementing - as well as going above and beyond - 29 recommendations by an independent panel that investigated the incident.

Earlier, Mrs Clinton's voice cracked with emotion as she described the moment she and President Barack Obama welcomed home the coffins of those killed in the Benghazi attacks.

"I put my arms around the mothers and fathers, the sisters and brothers, the sons and daughters, and the wives left alone to raise their children," she said.

Mrs Clinton testified in the afternoon before the House foreign affairs committee, where Republican members pressed her on why cables and other memos about security deficiencies in Benghazi seemed to have been ignored.

"The dots here were connected ahead of time. The state department saw this was coming," said Representative Ed Royce, a Republican and the chairman of the panel. "The state department didn't act."

Four state department employees have been put on administrative leave over the Benghazi attack.

Mrs Clinton, who is stepping down from her post in two weeks, has spent a month recuperating from a series of ailments in December, which delayed her testimony.

She is considered a strong candidate for the Democratic nomination for president should she run in 2016.

Mr Obama has nominated Democratic Senator John Kerry to replace her as Secretary of State.