Algerian President Abdelaziz Bouteflika, right, listens to Britain’s Prime Minister David Cameron as he delivers a speech in Algiers on Wednesday.

LONDON — British Prime Minister David Cameron made an unexpected visit to the Libyan capital of Tripoli on Thursday and announced that U.K. police officers will travel to the North African nation to investigate the Lockerbie bombing.

He also held bilateral talks to explore what support and expertise Britain can offer to Libya to strengthen its security and defeat terrorism.

Cameron told a press conference in Tripoli he was “delighted” that police would be able to visit Libya and “look into the issues” around the 1988 bombing of Pan Am Flight 103 over the Scottish town. The attack killed 270 people, many of them American.

The death last spring of Abdel Baset al-Megrahi — a former Libyan intelligence agent and the only man convicted over the Lockerbie bombing — renewed pleas from victims’ relatives for further investigation of the bombing. After the 2011 fall of dictator Moammar Gadhafi, Britain asked Libya’s new rulers to help fully investigate.

Cameron also said Britain was prepared to provide training and advice to Libya amid growing concerns over security in the region, pledging to help Libya’s police and army.

The prime minister’s visit to Tripoli — which came shortly after a stop in Algeria, where he struck a security partnership — also was just days after the U.K. Foreign Office warned of a potential threat against the British embassy in Tripoli.

Just before that, Britain joined other governments in urging its citizens in Benghazi, Libya’s second-largest city, to evacuate in response to what was described as an imminent threat to Westerners.

The Foreign Office on Thursday would not comment on the status of those threats but said it was “taking appropriate measures.”

But Libyan Prime Minister Ali Zidan described the calls for British and other European nationals to leave Benghazi as “sort of a precautionary measure,” telling reporters at a joint press conference with Cameron that “the situation is not worth worrying over.”

He accused “anti-revolutionary” forces for being behind all the talk about Benghazi’s deteriorating security situation.

“The security situation is fine, recovering and improving,” Zidan said, praising Cameron for visiting Libya and calling him a “responsible and a courageous man who cares about his country’s interests.”

Cameron also visited a police training center on the outskirts of Tripoli, telling police recruits it was “very good to be back.” He last visited Libya in September 2011, just after the fall of Gadhafi.

“I will never forget the scenes I saw in Tripoli and Benghazi,” Cameron said, according to Britain’s Press Association. “The British people want to stand with you and help you deliver the greater security that Libya needs. So we have offered training and support from our police and our military.”

The U.K. will double the number of advisers working on training Libyan forces to 16, bring the number of police advisers to three and embed another expert with Libya’s ministry of the interior.

Members of the Libyan navy will be invited to attend a five-month training course in England, and the U.K. will fund a 4.5 million-pound ($7.1 million) job creation package focusing on ex-militia.