Foreign Secretary Boris Johnson has said the man who controls eastern Libya has pledged to give up military rule if he becomes the country’s president.
Mr Johnson met Field Marshal Khalifa Haftar in Benghazi, which was recently declared free from extremists after three years of fighting.
The foreign secretary, who met the country’s prime minister on Wednesday, said he wanted stability in Libya.
The UK has pledged £9m to help tackle people trafficking and terrorism.
Mr Johnson is the first senior western politician to have visited the Libyan military commander on the ground at his home base near Benghazi.
Field Marshal Haftar’s forces control much of eastern Libya and he is seen as a key player if Libya is ever to be united, something the UN-backed government of national accord has failed to achieve.
While there have been questions about whether Field Marshal Haftar would ever allow his forces to be subject to civilian control, the foreign secretary said he had been given at least one assurance.
He told the BBC: “We are very clear, and so is Ghassan Salame, the UN special representative, that there has got to be civilian leadership in this country.”
Adding that while that does not mean there cannot be a role for Marshal Haftar, Mr Johnson said he accepted that were he to stand and be successful, “then he could not continue in his military role”.
After spending two days in Libya, visiting the many different sides of this deeply divided country, Mr Johnson said he was encouraged and that there was a chance of a political deal.
But he said other countries with different ideas about Libya’s future should unite behind a new UN plan expected to be announced next month.
“A secure and stable Libya, better able to deal with the threat from terrorism and the challenge of migration, is firmly in the UK interests,” Mr Johnson said.
“The Libyan people need a stable state that can meet their fundamental economic and security needs.
Adding that all sides needed to “compromise and work together”, Mr Johnson said only a united Libya could “defeat the terrorists and smuggling networks who are exploiting the instability”.
The BBC’s James Landale, who is travelling with the foreign secretary, said the visit highlighted just how insecure Libya remains.
On Wednesday, 11 of Marshal Haftar’s soldiers were beheaded by the so-called Islamic State group in the south of the country.
And in Benghazi, Mr Johnson was only able to hold his meetings within the safety of Marshal Haftar’s compound or the well-defended airport.
During Wednesday’s meeting with Libya’s unity government prime minister Fayez Sarraj in Tripoli, the foreign secretary said the UK would give the country more than £9m to bolster efforts to combat “terrorists, gun-runners and people traffickers”.
Mr Johnson said Libya was the front line in Europe’s struggle against illegal migration and terrorism.
The aid package includes £4m to support the removal of mines and improvised explosive devices, particularly in the city of Sirte, a former IS stronghold from which the militants were removed by Libya’s military earlier this year.