Jeremy Corbyn has been ridiculed after shifting his position on an independence referendum for the third time in two days.

The Labour leader said he would "certainly not" hold a referendum "in the first two years" of his government, when asked if the 2021 Holyrood election result could play a part in whether to hold a vote.

It came a day after he insisted there would be "no referendum in the first term" of his government – before U-turning on this position just hours later.

Nicola Sturgeon wrote on Twitter: “Yesterday it was ‘not in the first term’. Today, it’s ‘not in the first two years’. By the end of the week, at this rate, Corbyn will be demanding #indyref2020.”

Mr Corbyn was later asked by STV if he considered himself a Unionist.

He replied: "No, I would consider myself a socialist."

Scottish Tory leader Jackson Carlaw said Mr Corbyn could not be trusted on the Union.

He said: “Given how his position on a second independence referendum has weakened every time he has come to Scotland, pro-UK supporters in Scotland will be glad Mr Corbyn isn’t staying another day.

“Nobody now can have the slightly shred of doubt – Mr Corbyn is a clear and present danger to the most successful political union in history."

Mr Corbyn’s shifting message on independence has overshadowed his first campaign visit to Scotland ahead of December’s election.

During a visit to Glasgow on Wednesday, he ruled out a referendum in the first term of a Labour government.

However, he later backtracked on this position and said a referendum would not take place in the “early years” of his time in Downing Street.

He was asked about the issue again yesterday during a string of campaign visits to Dundee, Newtongrange in Midlothian, Linlithgow and Edinburgh, and clarified his position further.

There has been widespread speculation the SNP could prop up a minority Labour government in return for a second independence referendum.

However, Mr Corbyn has ruled out any pacts or deals with the SNP.

A Labour spokesman said Scottish leader Richard Leonard was clear an independence referendum would not be granted in the “formative years” of a Labour government.

Speaking to the BBC's Good Morning Scotland, former Labour cabinet minister Douglas Alexander said Mr Corbyn is “not the first Labour leader who has travelled north and found himself in difficulty in trying to clarify the position in relation to the constitution”.

He said: “My own view is that the position should be and must be pretty straight forward… I think Labour’s position should be where the majority of us are as Scots which is we want to remain within the United Kingdom and we want the United Kingdom to remain within the European Union. 

“We feel Scottish, British and European. But what we’ve seen, to put it kindly, is that ambiguity has not been a friend to the Labour party since the referendum in 2014 or indeed since the Brexit referendum in 2016.

“And having simultaneously left doubt in the minds of the 62 per cent of us who voted to remain within the European Union and the 55% of us who voted to remain in the United Kingdom, it helps explain why we start this general election campaign with such tough numbers for the Scottish Labour Party.”

Ms Sturgeon previously insisted she would not help a minority Labour government into power unless it accepted "the principle that whether there is a referendum in Scotland and what the timescale of that referendum should be, should be determined by the people of Scotland".

Last night, Mr Leonard said Labour's plan to transform Scotland with £70 billion of investment were "under threat from Nicola Sturgeon and the SNP, who are saying they would be prepared to vote down a Labour government".

And during an event at Edinburgh University's McEwan Hall, Mr Corbyn took a dig at media coverage. 

He told supporters: "This election is about a lot of things. What the election is about will not be decided by journalists based in Edinburgh, London or anywhere else – it will be decided by the people on the streets of this country, what the issues in this election are."

Earlier in the day, the Labour leader was heckled by a pro-independence campaigner during an event in Dundee.

Bob Costello, 72, called on Mr Corbyn to respect the "will of the Scottish people".

Mr Costello, the director of Sidlaw Executive Travel, was ordered to leave after a heated exchange with Mr Corbyn during his speech at Queens Hotel.

Contacted later by the PA news agency, Mr Costello said he was frustrated by the Labour leader's unclear stance, adding: "Yesterday he changed his mind about three times."