Media playback is unsupported on your device Media caption The four candidates are (clockwise from top left) Alyn Smith, Tommy Sheppard, Angus Robertson and Chris McEleny

Four candidates have put their name forward to replace Stewart Hosie as deputy leader of the SNP.

They include the party's Westminster leader Angus Robertson, and MEP Alyn Smith.

MP Tommy Sheppard and senior Inverclyde councillor Chris McEleny are the other two candidates.

The contest will be decided by the party's 120,000 members, with the winner announced at the SNP conference in October.

All five of the party's last leaders - Nicola Sturgeon, Alex Salmond, John Swinney, Gordon Wilson and Billy Wolfe - had previously served as the party's deputy leader.

The deadline for candidates to lodge their papers formally closed at 09:00. A series of hustings events will now take place around the country, with the first on 10 August in Peterhead.

The winner will be decided through a single transferable vote system that will see members rank the four candidates in order of preference.

Analysis by BBC Scotland political correspondent Glenn Campbell

Imagine the four contenders as Mr Men characters.

Angus Robertson would be Mr Experience, trading on his 15 years in the Commons where he questions the prime minister every week as the SNP's Westminster leader.

Like most in the party, Tommy Sheppard only joined through the independence referendum. He seeks to give the membership a bigger voice as Mr Grassroots.

Alyn Smith is Mr Europe. An MEP for 12 years, he sees himself as a Scottish "ambassador" to the EU and believes he could open more doors for Scotland in Europe if elected deputy leader.

Inverclyde councillor Chris McEleny is Mr Socialist. He wants Scotland to become an independent socialist republic and would like to steer the party towards more left-wing policies like higher tax for higher earners.

Each have had to secure at least 100 nominations from 20 different branches to take part in the election.

As the highest profile candidate, Angus Robertson probably starts as favourite but with more than 120,000 (mostly new) members the SNP electorate is hard to second guess.

All party members who joined before the contest was called should be able to take part.

Voters are asked to rank candidates in order of preference under the single transferable vote system.

There will be hustings around the country before the ballot starts on 21 September. Most votes will be cast online by the closing date, 12 October.

The winner will be announced at the start of the SNP conference in Glasgow on 13 October.

New members

Mr Robertson, the MP for Moray who has already held several senior positions within the party, is widely regarded as the early frontrunner in the contest.

But with tens of thousands of new members joining the SNP since the independence referendum in 2014, the door could be open for a surprise winner to emerge.

Mr McEleny, who is the only non-parliamentarian to put his name forward, is seeking to push the SNP to the left after calling for the party to embrace more "socialist values" and to drop its commitment to keeping the monarchy after independence.

Image caption Stewart Hosie announced in May that he would be standing down from the role

Image copyright PA Image caption The new deputy leader will be decided by the SNP's 120,000 members

Mr Sheppard, the MP for Edinburgh East, has stressed the importance of giving the party's grassroots a bigger role, and has argued that the SNP needs an "organisational upgrade" if it is to meet the challenges to come, including any new referendum on independence.

And Mr Smith, a member of the European Parliament since 2004, has said his experience would be crucial as the SNP attempts to navigate through the post-Brexit waters.

Mr Hosie announced in May that he would be standing down from the role after newspapers reported he had been involved in an affair with a journalist.

He had recently separated from his wife, the SNP MSP Shona Robison, who is also Scotland's health secretary.