Security in Libya was reduced before last month's attack on the American consulate in Benghazi, even as violence worsened, a US panel has heard.
A former US Army official in Libya, Lt Col Andrew Wood, said that security in the country had been "weak".
The rancorous congressional committee hearing centred on whether the state department had sought enough diplomatic security staff for the mission.
The BBC's Mark Mardell says Wednesday's session was highly political.
A month before the US election, Republican candidate Mitt Romney has been making the Benghazi attack the centrepiece of his case against President Barack Obama's foreign policy.
'Rare and extraordinary'
Lt Col Wood told Wednesday's hearing of the House Committee on Oversight and Reform that when he arrived in Libya in February there had been three US diplomatic special security teams in the country, but by August they had been withdrawn.
He also said that the security situation in Libya had worsened before the 11 September attack, in which four Americans died, including Ambassador Chris Stevens.
He said he had visited Benghazi twice and was there in June when the British ambassador's convoy was attacked, one of a dozen incidents before the assault on the consulate.
"The security in Benghazi was a struggle and remained a struggle throughout my time there," Lt Col Wood told the congressional hearing.
"Fighting between militias was still common when I departed. Some militias appeared to be disintegrating into organisations resembling freelance criminal operations.
"Targeted attacks against westerners were on the increase."
He said that in June there had been a direct threat made against the ambassador on Facebook, mentioning that he liked to jog regularly.
State department officials defended themselves during the hearing from accusations that they had been unprepared.
"We had the correct number of assets in Benghazi at the time of 9/11," said Charlene Lamb, the deputy secretary of state for diplomatic security.
She noted there had been five diplomatic security agents in Benghazi at the time of the attack, as well as extra security staff.
However, White House spokesman Jay Carney told reporters on Wednesday that in hindsight there was "no question that the security was not enough to prevent that tragedy from happening".
Patrick Kennedy, undersecretary of state for management, told the hearing that the Benghazi incident had been "an unprecedented attack by dozens of heavily armed men".
His statement echoed a state department briefing on Tuesday that the government had never concluded the sacking of the Benghazi mission was motivated by a US-made video ridiculing Muslims.
In the days after the attack Mr Obama's ambassador to the United Nations, Susan Rice, described it as a "spontaneous" one that arose out of a protest against the film.
Mr Kennedy suggested that Obama administration officials had been working off the best intelligence they had at the time.
Reuters news agency reported last week that hours after the attack the White House had received a dozen reports suggesting al-Qaeda-linked militants were responsible.
The top US security chief in Libya until July, Eric Nordstrom, also appeared before the committee.
Mr Nordstrom testified that he had been criticised for seeking more security.
"There was no plan and it was hoped it would get better," he said.
He told the committee that conversations he had with people in Washington had led him to believe that it was "abundantly clear we were not going to get resources until the aftermath of an incident".
During the hearing, Democrats accused committee chair Darrell Issa and his Republican-controlled panel of refusing to make witnesses available, withholding documents and effectively excluding Democrats from a fact-finding trip to Libya.
Republicans accused state department officials of not being fully co-operative with their probe.
Democratic staff noted that House Republicans had voted for an embassy security funding package that was $459m (£286m) less than what the Obama administration had requested.