Image copyright EPA Image caption David Cameron said Britain was ready to take an "active role" in helping Libya

The UK is set to send a Royal Navy warship to the Mediterranean to help tackle arms smuggling in Libya, Prime Minister David Cameron has announced.

He told the G7 summit in Japan the UK was ready to take an "active leadership role" in helping Libya deal with people trafficking and the migration crisis.

The UK already has a survey vessel, HMS Enterprise, operating in the area.

Officials are to seek UN approval for the new warship to seize boats taking arms to so-called Islamic State.

The new Government of National Accord (GNA) in Libya last week asked the European Union - which is running a mission, called Operation Sophia, in the area - for more assistance.

It requested help in training its navy and coastguard, as well as stopping the trafficking of migrants across the Mediterranean.

The GNA is also believed to be considering a request for international ships to operate in Libyan waters.

'Stabilise Libya'

Speaking in Japan, Mr Cameron said Libya was "a danger to all of us" and the UK would deploy a warship to the area, subject to the UN approving Libya's request.

He said the UK was "working closely" with the EU to tackle people-trafficking in the central Mediterranean.

The UK also plans to send a training team to "assist" with the implementation of plans to help train the Libyan coastguard, he added.

Mr Cameron said the plans would "help stabilise Libya, secure its coast and tackle the migration crisis".

Analysis

Image copyright EPA Image caption The capsizing of a boat in the Mediterranean was caught on camera by the Italian navy this week

By Jonathan Beale, BBC defence correspondent

There are a number of motives for David Cameron's announcement.

Another year of desperate migrants crammed into small boats fleeing to Europe heightens demand for western intervention.

But it is not just humanitarian reasons. Mr Cameron is also trying to win a referendum, which has exposed public concern about immigration.

And then there's the question of how to combat the Islamic State group's foothold in Libya.

But before he can intervene there are big obstacles ahead.

The Royal Navy is trying to work out what it can do (it is still not clear what additional warship it might send).

Training Libya's barely existent coastguard won't be easy either. Where could it be done in safety and when Libya's fledgling unity government doesn't want western boots on the ground?

Western countries have not yet had a formal invitation to even enter Libyan waters.

As for intercepting boats that might be carrying weapons or being used by trafficking gangs, that would require a UN Security Council Resolution.

The untold story of Europe's drowned migrants

The EU operation - which currently has five ships, including an Italian aircraft carrier and frigates from Spain and Germany - has faced strong criticism.

A House of Lords committee published this month said the mission was failing to achieve its aims and does not "in any meaningful way" disrupt smugglers' boats.

'Grand gesture'

The deployment of a warship would be "quite a substantial move forward" toward direct UK military involvement in the Libyan conflict, BBC diplomatic correspondent James Landale said.

But former Rear Admiral in the Royal Navy Chris Parry said the type of warship and role it would undertake was "unclear".

"I think because it's happening at the G7, and we have a referendum, this has the nature of a grand gesture. I don't think the details have been worked out yet quite frankly," he told BBC Radio 4's Today programme.

Crispin Blunt, chairman of the Commons foreign affairs committee, said it was crucial the international community "get the politics right", and make sure countries such as Egypt were not "playing a double game" by supporting powers other than the GNA.

On Thursday, Mr Blunt called for "proper accounting" of what British special forces are doing in Libya, following reports by the Times that UK troops fired a missile to destroy an IS truck packed with explosives.

Image copyright AFP Image caption Libya has been beset by fighting since 2011

In 2011, the UK assisted international efforts to back rebels fighting to overthrow Libyan leader Muammar Gaddafi.

The rebels succeeded but the country has since descended into civil war, with the formation of hundreds of militias - some allied to IS.

Aid agencies say the sea-crossing between Libya and Italy is now the main route for migrants trying to get to Europe.

It follows a EU deal with Turkey, which came into effect in March, to curb the number of people sailing across the Aegean Sea, towards Greece.

Nearly 6,000 migrants trying to reach Europe illegally have been rescued from flimsy craft in the Mediterranean in recent days, officials have said.