Britain and Algeria could work together to respond to any future hostage crisis under a deal unveiled by David Cameron.
The Prime Minister said a new security partnership could see greater intelligence-sharing to tackle al Qaida-linked extremism and joint planning for major incidents.
The plans emerged as Mr Cameron became the first UK premier to visit the North African country for 50 years. In a further sign of the increased importance being attached to the relationship, MI6 chief Sir John Sawers and National Security Adviser Sir Kim Darroch have also joined the trip.
At a press conference following talks with Algerian counterpart Abdelmalek Sellal, Mr Cameron reiterated the importance of a "tough and intelligent" response to the growing threat from terrorists in the region.
"Both Britain and Algeria are countries that have suffered from terrorism and we understand each other's suffering," he said. "What we have agreed is a strengthened partnership that looks at how we combat terrorism and how we improve security of this region. This should be about sharing our perspectives, about the risks and dangers that there are, but also sharing expertise."
The countries are proposing to boost co-operation on issues such as border and aviation security, and preventing the spread of extremist ideology. Britain has also invited Algeria to take part in a joint contingency planning exercise to share experiences in crisis response.
Some 37 foreigners, at least 10 Algerians and dozens of terrorists died in the attack on the In Amenas gas plant, which is jointly operated by BP, earlier this month.
The Algerian government took the controversial decision to storm the site in the Sahara desert, with Mr Cameron and other world leaders protesting about not being notified in advance. However, senior Government sources insist relations between the governments were not damaged by the events.
Mr Cameron paid his respects at the imposing Martyrs Monument overlooking the Bay of Algiers. After laying a wreath at the memorial, originally built to mark the country's war for independence from France between 1954 and 1962, he stood with his head bowed for more than a minute. The Prime Minister also met staff at the British Embassy in Algiers to thank them for their work during the hostage crisis.
Meanwhile, Britain is offering to send human rights experts to provide training to the Malian armed forces on preventing and responding to sexual violence as part of the EU training mission, Foreign Secretary William Hague said. "This will be designed to enable them to better protect civilians and to act responsibly, particularly towards women," he said. "Providing support directly to the Malian forces is essential. Demonstrating respect for the rights of civilians by addressing these crimes is ultimately the responsibility of the Malian authorities."