The Scottish Secretary has insisted he is prepared to work for as "long as it takes" to agree Scotland's new funding settlement.

David Mundell told the Commons that "difficult issues" need to be resolved between the Westminster and Holyrood governments although he remains confident a deal can be agreed as both sides are on the same page.

He noted one government may be at the top of the page while the other is at the bottom, adding it is "eminently possible" they can both move to the middle.

The Scottish Government has set a February 12 deadline for an agreement on the funding that underpins the Scotland Bill, the law designed to deliver on "the vow" of more powers in the final days of the independence referendum.

Scotland's Deputy First Minister John Swinney believes a February 12 deal is essential to give Holyrood time for scrutiny ahead of the dissolution of parliament for the Scottish Parliament elections in May.

Labour has called for the deadline to be dropped and for both governments to remain at the negotiating table until an agreement can be reached.

Speaking during a parliamentary debate, Mr Mundell said: "I don't think in terms of self-imposed or arbitrary deadlines.

"Personally, keen though I am to have a warm and supportive relationship with the Scottish government, I have never felt the St Valentine's Day date had much relevance to this process.

"I'm willing to continue working towards a deal as long as that takes and as long as we can.

"However, the usual channels have agreed to move the next day of committee on the Scotland Bill in the other place to February 22 as discussions on the framework continue to progress to enable us to give their lordships as full an update as possible."

Mr Mundell said the Government had "shown flexibility in the negotiations" and that "compromise proposals" have been put on the table.

"This is a clear signal of our commitment to reach agreement and our willingness to be as flexible as we can within the Smith principles," he said.

Earlier, Mr Mundell was pressed to outline the UK Government's stance on certain aspects of the talks.

He told MPs: "We're in a negotiation, it's an ongoing negotiation. I remain optimistic that it will reach a positive conclusion.

"I have to say I don't recognise some media reports which say there's a gulf between the two governments.

"I believe we're on the same page - one government may be at the top of the page, one government may be at the bottom of the page, but it's eminently possible to move us both to the middle of the page.

"And that is what (Treasury Minister Greg Hands) and the Deputy First Minister (John Swinney) will continue to do when they next meet.

"The Government is doing all we can to get to an agreement based on the Smith principles."

The SNP's Neil Gray (Airdrie and Shotts) asked Mr Mundell to commit to a position of "non-detriment" to the Scottish budget.

Mr Mundell replied: "What I commit to is a fair settlement for Scotland and we are ongoing in those discussions."

He said he is confident this can be achieved.

Opening the debate, shadow Scottish secretary Ian Murray said Scots are being "locked out" of the discussions.

He said light needs to be put on the "very secret" talks.

Labour MP Alex Cunningham (Stockton North) asked Mr Murray: "Do you agree with me that there are some amazing parallels between these negotiations and those of the Prime Minister and his EU negotiations - that we're kept totally in the dark all along and then we found out there was nothing to see anyway?"

Mr Murray replied: "Absolutely and I suspect that's perhaps what part of the problem is in here."

Mr Mundell also insisted the Government is "negotiating in good faith".

He said: "I give an absolute undertaking to this House that I will do everything in my power to achieve a deal which is fair to Scotland and fair to the whole of the United Kingdom.

"I remain optimistic that we can get such a deal and that our debates can then move on to how these new powers and the existing powers of the Scottish Parliament can be used to improve the lives of the people of Scotland."

Stewart Hosie, the SNP's economy spokesman, said that negotiations are taking place in the context of the middle of a "decade of UK austerity" as he raised concerns about funding cuts.

"The key thing is that Scotland's budget has been cut and will continue to be cut by this government which makes the achievements of the Scottish government all the more remarkable," he said.

Mr Hosie agreed with Mr Mundell that privacy is required for the negotiations.

"It is absolutely right in terms of the negotiations that they are done privately," he said.

"Imagine if there's a running commentary and slight snippets of information out of context simply become the fodder of a new Labour project fear campaign.

"We don't want to see that. We want to see instead of sniping from the sidelines a Labour Party determined to support fair play, a fair settlement and one which actually delivers to the principle of no detriment."

Mr Hosie said the SNP will only sign a deal that abides by the principle of no detriment.

"We will not agree to a fiscal agreement which abandons no detriment and embeds unfairness into the Scotland Bill," he said.

SNP MP Deidre Brock (Edinburgh North and Leith) warned the Government that May's Holyrood elections will be defined by the Scottish people "setting their face" against the UK Government if a deal is not reached.

She said: "We understand Labour's frustration, we all want to know what's going on, but it would be a foolish negotiator who gave away their entire position with the first round of tea.

"Time is running out though and if the deal is not done the Scottish government will be left with no choice but to take the issue back to the people.

"A deal that isn't good for Scotland won't be acceptable either to the Scottish government or to we who sit on these benches casting a gimlet eye in the UK Government's direction.

"So a couple of weeks will determine whether the coming Scottish Parliament election is fought in a spirit of good spirited competition.

"The alternative will be a Scottish electorate once more setting its face against a UK Government that has forgotten that governing can only be by consent."

But Labour former minister Kevan Jones said that whatever happens the SNP will conduct the election with a "victim mentality" rather than setting out what the party would do with the new powers given to it.

He accused the SNP of "not giving a damn" about the rest of the UK but blaming it for being given a poor deal.

He said: "What we are not going to do this May in Scotland is actually have a real debate about the use of those powers and what they would actually put forward.

"What we are going to do is have the victim mentality, where they can easily blame the rest of us in the UK for the poor deal they got where frankly they do not give a damn about my constituency or anybody else in the UK."

The SNP amendment calling for a principle of "no detriment" in terms of funding to Scotland to be upheld was defeated by 297 votes to 54, majority 243.

Labour's motion calling for the negotiations to conclude before the Holyrood elections and the publication of minutes and papers from them was defeated by 295 votes to 201, majority 94.