Image copyright PA Media/Getty Images

A great deal of attention is focused on the Conservative Party as it chooses the next prime minister after Theresa May's resignation, but the Liberal Democrats are also busy picking a new leader. The outcome could have an impact on what happens with Brexit.

Why does the Lib Dem leadership matter?

Despite only having 12 MPs, the Lib Dems have tried to position themselves as the main anti-Brexit party.

They are calling for another Brexit referendum and - if that happened - would campaign for the UK to remain in the European Union.

By contrast, both Labour and the Conservatives have been plagued by infighting over their Brexit strategies.

The splits in the two main parties appear to have benefited the Lib Dems.

In May's European Parliament elections the Lib Dems came second with 16 seats - behind the Brexit Party's 29.

Image caption The European elections, held at the end of May, saw significant Lib Dem gains

That result, accompanied by recent surges in the opinion polls, represents a remarkable turnaround.

In the 2014 European elections - when the Lib Dems were in a coalition government with the Conservatives - they lost all but one of their MEPs (Members of the European Parliament).

It got worse. In the 2015 general election they lost 49 of their 57 MPs and left government.

The party was written off by many as a spent force. But its anti-Brexit position appears to have breathed new life into the party, at least for the time being.

Who are the contenders?

The current leader, Sir Vince Cable, told party members in May he was standing down after two years in charge.

The 76-year-old said it was time "to make way for a new generation".

In the race to take over, two contenders have emerged: Jo Swinson and Sir Ed Davey.

Jo Swinson

Jo Swinson has been Sir Vince's deputy for two years, and speaks for the party on foreign affairs.

In the 2015 general election she lost her East Dunbartonshire seat to the Scottish National Party, but won it back two years later. She has also served in government - as a business minister in the coalition government until 2015.

On Brexit, Ms Swinson wants to block a no-deal Brexit - an outcome she compares "to planning for your house to burn down".

She says some Conservative MPs would support her, when faced with a "disastrous" outcome for the country.

Ms Swinson has ruled out joining forces with Labour to form a government, describing leader Jeremy Corbyn as a "Brexiteer".

Instead, she wants to work informally with MPs from all parties.

If she wins, Jo Swinson would become the first female leader in the Lib Dems' 31-year history.

Sir Ed Davey

A key figure in the Conservative-led government, Sir Ed Davey became energy and climate change secretary in 2012.

Sir Ed also had an unplanned break from Parliament. In 2015 he was defeated in his Kingston and Surbiton seat after 18 years as an MP, but won it back from the Conservatives in 2017.

He says a vote of no confidence in the government could prevent a no-deal Brexit - something he describes as the "nuclear option".

In such a scenario, Sir Ed says he would push for the Lib Dems to form a temporary government with other parties.

"That would just be a temporary government for one purpose and one purpose alone - to pass the legislation for a people's vote," he said, making the case for another public vote on the issue.

Like Ms Swinson, he has ruled out working with Jeremy Corbyn - but he's said he would be willing to work with other Labour MPs, including Yvette Cooper.

On many of the other key issues, there are few big differences between the contenders.

That's because Lib Dem policy is decided by its members at party conference, and not by the leader.

Who gets to choose the leader?

The leader will be chosen by Lib Dem party members. Just over 106,000 people have been sent ballot papers.

Research carried out by the Party Members Project - run by professor Tim Bale of Queen Mary, University of London - shows the average Lib Dem member is around 50 years old - younger than the Conservatives and Labour, but not quite as young as the Greens.

It also reveals most members are relaxed about immigration, and 90% voted Remain in the referendum.

The poll will close on 23 July. But the timing for the announcement is yet to be set, because another announcement that day could overshadow the Lib Dems.

It's also the day the the new prime minister is expected be revealed.