Jeremy Corbyn has confirmed he believes Westminster should not block a second referendum on Scottish independence, but said he opposed the breakup of the UK.

Corbyn implicitly endorsed remarks by his close ally John McDonnell last week where he said a Labour government would not obstruct a fresh independence vote if there was sufficient support for one in the Scottish parliament.

Holyrood cannot hold a referendum without being given the powers to do so by the UK parliament. The 2014 independence vote was held after months of negotiations between the UK and Scottish governments resulting in the Edinburgh agreement of 2012.

The shadow chancellor had said Corbyn agreed with him, fuelling a bitter row with Scottish Labour, which has campaigned vigorously against staging a second independence vote.

The BBC asked Corbyn on Wednesday whether that was true. The Labour leader said: “It’s not up to parliament to block it but it’s up to parliament to make a point whether it is a good idea or not. I do not think it is a good idea.”

David Mundell, the Conservative MP whom Boris Johnson sacked as Scottish secretary last month, has also said Westminster should not block a Scottish referendum if pro-independence parties win a majority at the next Holyrood election, due in 2021.

Corbyn’s new stance, which has not been put to a vote of party members, has deepened suspicions that Labour is laying the ground for a deal with the Scottish National party in the event of a hung parliament after the next election.

Corbyn’s call for cross-party support for a temporary Labour government to thwart Johnson’s plans for a no-deal Brexit were received relatively warmly by Nicola Sturgeon, the first minister, and Ian Blackford, the SNP’s Westminster leader.

Sturgeon said she had long supported forming “a progressive alternative” to a Tory government at Westminster, but ruled out a formal pact with Labour. “It’s my view that the consequences and implications of a no-deal Brexit are so severe is we should be exploring all options and we shouldn’t be ruling anything out,” she said.

Speaking at a festival fringe event in Edinburgh, Sturgeon said Corbyn’s change of stance on a second referendum suggested a consensus was emerging in favour of a second independence vote. She ruled out holding an unofficial referendum without Westminster’s legal backing.

“We need to have a process that’s legitimate, legal and probably most important of all, that’s going to be recognised [internationally],” she said.

“Why should I be talking about the alternatives to doing it the right way. It’s the people who are trying to block us doing it the right way who should be under pressure … particularly now, when that undemocratic and unsustainable position has started to crumble.

“Even within the Tories you’re starting to see them: ‘Aye well, okay, maybe if they got a majority in 2021.’ So let’s just keep the pressure there, so we can have the referendum in the right way, the gold standard way and then Scotland can become an independent country.”

Corbyn sought to placate his Labour critics by insisting he would campaign against independence, and urge a no vote in the event of a referendum.

“My view is I’m not in favour of Scottish independence,” he told the BBC. “A referendum took place and a decision was reached on that. What I would much rather is a Labour government given the chance to ensure that Scotland also gets the investment it needs, also gets the social justice it needs, and also gets the job opportunities for young people which have been denied.”