David Petraeus, the former CIA director, told congressional hearings on Friday that he had always known a terrorist group had been involved in an attack in Benghazi that left the US ambassador and three other Americans dead.

According to reports from members of Congress who attended the closed-door hearings, Petraeus said the information had been included in the original set of talking points prepared by the CIA for the Obama administration. But he said it was removed from the one provided to the UN ambassador, Susan Rice, who used it as the basis for a series of interviews on the weekend after the killings.

Rice is among the contenders to replace Hillary Clinton as US secretary of state. In a press conference this week, Barack Obama, angrily criticised two Republican senators, John McCain and Lindsey Graham, who threatened to block her nomination if the president put her name forward.

Petraeus, who gave evidence to both the Senate and House intelligence committees, said that references to the group alleged to have been behind the 11 September attack were in the CIA's classified talking points, which were classified, but removed from the unclassified memo relied upon by Rice. The reason, he said, was not to tip off the group about what the US authorities knew.

Briefing reporters later, Republicans and Democrats on the committees put different glosses on the evidence given by Petraeus, who resigned a week ago over an extramarital affair.

Peter King, the Republican chairman of the House intelligence committee, said he was not satisfied with Petraeus's explanation of the talking points. King said: "It is still not clear how the final talking points emerged. He said it went through a long process involving many agencies including the Justice Department and including the State Department.

"No one knows yet who came up with final version of the talking points other than to say the original talking points prepared by CIA were different from the ones that were finally put out."

Dianne Feinstein, the Democratic chairwoman of the Senate intelligence committee, accused McCain and Graham of unfairly targeting Rice. Feinstein, who did not refer to the senators by name, accused them of trying to "assassinate her character".

She added: "The key is they [the talking points] were unclassified talking points at a very early stage. And I don't think she should be pilloried for this. She did what I would have done or anyone else would have done who was going on a weekend show."

A Democratic member of the House, Adam Schiff, said: "The general was adamant there was no politicisation of the process, no White House interference or political agenda. He completely debunked that idea."

Petraeus had been scheduled to give evidence on Thursday but after that hearing was dropped after he resigned due to revelations of an affair with his biographer, Paula Broadwell. Some Republicans hinted he had resigned not because of the affair but to avoid giving evidence. Under pressure, he agreed to testify, and the hearings were rescheduled for Friday.

To avoid the embarrassment of facing a media scrum, Petraeus was smuggled in and out of Congress. He made only a passing reference to the affair that brought him down, mentioning it only to express regret and to say it had not influenced earlier testimony about Benghazi.

A Libyan-based group, Ansar al-Shariah, which the US describes as having loose links with al-Qaida sympathisers in north Africa, is being blamed for the Benghazi attack, which killed the US ambassador, Chris Stevens. Republicans have been relentlessly pursuing the issue for almost two months, suggesting that the Obama administration deliberately played down the al-Qaida link for political reasons.

Having claimed that al-Qaida had been largely defeated, the Obama administration did not want to admit that a group with possible al-Qaida links had been behind the killings on the 9/11 anniversary, according to Republicans.

Rice, in her interviews, had suggested the attacks were largely motivated by a spontaneous demonstration by protesters against a US-produced anti-Muslim film and she put less emphasis on the attack being organised by extremists.

During the hearings, Petraeus – who has once been touted as a possible Republican candidate – appears to have undercut GOP arguments, saying the aftermath of Benghazi had not been a political issue and that there had been no attempt by the White House to distort the talking points in advance of Rice's appearance before the media.

Democratic members of Congress had until now largely stayed out of the row about Rice. But they came out strongly in support of her for the first time on Friday, possibly as the result of some behind-the-scenes prodding from the White House.