Former CIA chief Gen David Petraeus has told lawmakers that the deadly assault on a US consulate in Libya was a terror attack. During two appearances on Capitol Hill on Friday he said the public explanation had been edited to prevent alerting groups under suspicion. He gave evidence to the House Intelligence Committee and its Senate counterpart, both in closed session. The testimony on Benghazi came one week after Gen Petraeus quit over an affair. Gen Petraeus has said he left his post at the CIA only because of his extramarital affair with biographer Paula Broadwell, and not because of the CIA's handling of the attack. He was briefly questioned over his personal life at the start of the morning's proceedings, but lawmakers accepted his word that his affair had not compromised national security. Republicans have criticised the White House over the events in Benghazi, saying the administration misled the public. US Ambassador to Libya Christopher Stevens was among the four Americans who died in Benghazi on 11 September. Although the hearings were held behind closed doors, committee members did emerge to give reporters some insight on what happened. Gen Petraeus told the committee the CIA was aware the attack was planned by terrorists from an early stage, New York Congressman Peter King said after the first session. But Mr King said the general's evidence on Friday conflicted with what he said at a hearing on 14 September. Mr King said he had a "very different recollection" of the earlier hearing, at which lawmakers had been told the attack grew out of spontaneous protests over an anti-Islamic film. He added that despite Gen Petraeus' testimony on Friday it was still not clear who approved the message that the attack was linked to the protests. Gen Petraeus told the lawmakers that references to terror groups were removed from the final version of the administration's "talking points" on Benghazi, although he was not sure which federal agency deleted it. Democrats said the former CIA director made clear the change was made for intelligence, not political reasons.