The world's most powerful democracies were joined at annual summit talks by African leaders whose countries are all implicated in the migration crisis affecting Europe.
Lawlessness in Libya has facilitated the transit of hundreds of thousands of African migrants embarking on perilous voyages across the Mediterranean.
And it is now directly implicated in European terrorism after a Briton of Libyan extraction blew himself up at a Manchester concert, killing 22 people including several children.
"The fight against terrorism (in North Africa) demands that urgent measures be taken to extinguish the Libyan cauldron," Niger's President Mahamadou Issoufou told the G7 countries.
Niger lies to Libya's south and Issoufou said a holistic approach was needed to deal with issues surrounding security, economy and extremist ideology.
He urged both the G7 and the United Nations to "devote the means necessary" to set up a rapid reaction force against regional jihadists sought by Niger and other countries in the Sahel region.
France and Britain, two of the G7's top military powers alongside the United States, face particular criticism for helping to topple the Libyan regime of Moamer Kadhafi in 2011 without planning sufficiently for the power vacuum that ensued as the country plunged into chaos.
British Prime Minister Theresa May, at the G7, said the Manchester suicide bomber's links to Libya "undoubtedly shine a spotlight on this largely ungoverned space on the edge of Europe".
"So we must redouble our support for a UN-led effort that brings all the parties to the negotiating table and reduces the threat of terror from that region," she said Friday.
In a meeting Saturday on the G7 margins with his French counterpart Emmanuel Macron, Tunisian President Beji Caid Essebsi underlined the need for collective action on Libya.
The security challenge, in particular dealing with the proliferation of armed groups, would take "long months to stabilise", Essebsi said, according to a French official.