Hillary Clinton has called for increased US military and political intervention in north Africa, and warned of a long, difficult but necessary struggle against a "spreading jihadist threat" in the region.

The US secretary of state singled out the French-led intervention against armed Islamists in Mali as the most urgent crisis, but said that al-Qaida in the region, newly armed and invigorated by the fallout of the Arab revolutions, also threatens important allies such as oil-rich Nigeria, as well as the fledgling government in Libya.

Clinton, who is due to leave office shortly, told the Senate foreign relations committee that jihadists in north Africa pose a direct threat to the US, and called for an increased role for the American military command for Africa, known as Africom, as well as providing the resources for governments in the region to defend themselves.

"We now face a spreading jihadist threat. We have driven a lot of the AQ [al-Qaida] operatives out of Afghanistan, Pakistan. We have killed a lot of them, including, of course, Bin Laden. But we have to recognise that this is a global movement," she said.

Clinton was testifying at a hearing by the committee on the Benghazi consulate attack in Libya last September in which the US ambassador Chris Stevens and three other Americans were killed. She was accused of incompetence and evasion but gave a strong, and a times emotional, defence of her handling of the incident.

On the growing threat from north African militants, Clinton said it would be a mistake to think that because the al-Qaida-aligned groups, which she called "not only a terrorist syndicate (but) a criminal enterprise", have not attacked on US soil they do not represent a threat to America.

"What we have to do is to recognise we are in for a long-term struggle here. That means we've got to pay attention to places that historically we have not chosen to or had to," she said.

Clinton said the instability has been fuelled by a flow of weapons from several countries in the region, particularly post-revolutionary Libya after Muammar Gaddafi's well stocked armouries were looted.

"This Pandora's box of weapons coming out of these countries in the Middle East and north Africa is the source of one of our biggest threats. There's no doubt that the Algerian terrorists had weapons from Libya. There's no doubt that the Malian remnants of al-Qaida in the Islamic Maghreb has weapons from Libya. We have to do a much better job," she said.

Following last week's jihadist assault on an Algerian gas plant, in which 37 foreign and Algerian workers were killed, Britain said it will shift resources from a sole focus on Afghanistan, Pakistan and the Middle East towards what the prime minister, David Cameron, described as a "generational struggle" against al-Qaida in North Africa.

The US secretary of state singled out Mali, where American forces are giving logistical support to the French military fighting Islamist groups that seized the north of the country. Clinton warned that the fighting there has echoes of Afghanistan.

"This is going to be a very serious ongoing threat because if you look at the size of northern Mali, if you look at the topography, it's not only desert, it's caves – [it] sounds reminiscent. We are in for a struggle. But it is a necessary struggle. We cannot permit northern Mali to become a safe haven," she said.

Clinton said that weak states and the new revolutionary governments in north Africa were vulnerable to attack and require American support.

"We have been working to upgrade security around northern Mali, around a number of the countries. Algeria is the only one with any real ability to do that. Most of these countries don't have the capacity to do that. We are now trying to put together an African force from Ecowas (the Economic Community of west African States) so that African soldiers will be in the front of this fight," she said.

Clinton added: "We've got to have a better strategy. I would hope we have not only a strategy that understands making it possible for these governments to defend themselves better, for people to understand and agree with us that these terrorists are not in any way representative of their values, but that we can bolster democracy and tried to give these Arab revolutions a real chance to succeed."

However, that approach is complicated by the fact that the military government of Mali overthrew a democratic administration when it seized power.

Clinton said Somalia provides an example of what US military and diplomatic assistance can do to push back the jihadist threat. "Four years ago al-Shabab was one of the biggest threats not only to east Africa but the United States," she said.

The US secretary of state said that American military training of the Ugandan and Burundian armies to intervene in Somalia, along with American money and knowhow, had changed the equation in Somalia and seen the Islamist threat recede.

"We have to make the decision we're going to do the same in North Africa as well," she said.

Clinton said the US also needs to rethink the role of its Africa Command military group, which is based in Germany and known as Africom.

"Africom was stood up about 10 years ago. I think a lot of people at the time wondered why would we have another command in the world and why in Africa. I now think we need to pay much more attention to Africom, to its capacity inside Africa," she said.

The US secretary of state appeared before the Senate foreign relations committee to testify about the attack on the American consulate in Benghazi in which the US ambassador to Libya, Chris Stevens, and three other US officials were killed.

Clinton gave a generally confident performance, acknowledging security failures while noting that the state department was facing a series of security threats at the time from Cairo to India because of protests over an anti-Muslim video made by a man in California. She denied having personally ignored requests for greater security in Benghazi, saying they were not handled by her office.