A last-ditch attempt to force all companies bidding for public contracts to pay their staff the Living Wage has been rejected by MSPs at the Scottish Parliament.

Holyrood voted down a bid by Labour to introduce a "Scottish Living Wage duty" - which would make it mandatory for firms who wanted to win work from the public sector to pay their staff this rate.

With public bodies spending £10 billion a year on goods and services, the Scottish Government has brought forward legislation aimed at maximising the economic benefit this brings.

Labour hoped to amend the Procurement Reform (Scotland) Bill to make it a condition that companies who get public sector contracts must pay their workers the Living Wage - currently £7.65 an hour in Scotland.

The party's infrastructure spokesman James Kelly argued such a move would "give a pay boost to thousands of workers on low pay".

Deputy First Minister Nicola Sturgeon insisted ministers were tackling the issue of the Living Wage in the "strongest way possible", but said making its payment a mandatory part of public contracts did not meet European laws.

After a heated debate in Holyrood, MSPs voted by 44 to 74 against introducing a "Living Wage duty".

Mr Kelly had said such a change would mean thousands of low-paid workers would be as much as £2,600 a year better off.

Almost two-thirds of those who would benefit are female workers, Mr Kelly said, telling MSPs: "This is an opportunity not only to help women but an opportunity to tackle low pay in public contracts.

"This is a chance to give cleaners and care home staff from Cambuslang to Carnoustie a fair deal."

He insisted the legal position was "clear", saying: "Living Wage conditions may be included in public performance clauses of a public procurement contract."

He challenged Nationalist MSPs, who have already voted against his proposals at a Holyrood committee, to back him.

"Do the SNP MSPs want to make a positive change or have they come here simply to pose in the Parliament's coffee bars?" Mr Kelly demanded.

"The point of legislation is to make a difference, let's not be a pretend wee Parliament, let's stand up and be counted.

"Vote for the Living Wage and give a pay boost to thousands of workers on low pay."

Ms Sturgeon had already announced the Scottish Government would alter the Bill so public authorities are required to set out their policy on the Living Wage in their procurement strategy.

The legislation will also allow ministers to issue statutory guidance on workforce matters - including pay - for the procurement process. An amendment proposed by the Government includes an explicit reference to the Living Wage, making clear this is one of the factors authorities must evaluate, where this is relevant.

She told MSPs today that these changes were both "meaningful and legal".

The Deputy First Minister said: "This Bill will impact on £10 billion worth of spending each year, that means it does matter that we do everything we can in this Bill to ensure that money is spent in a way which contributes to economic prosperity, equality and social justice.

"It also means if we get it wrong and end up with court challenges it will be very costly indeed for Scotland's taxpayers.

"I want to ensure that we abide by the law and we don't put our public bodies at risk of being taken to court."

Ms Sturgeon added: "It is worth reiterating our record on this issue - we are the first Scottish Government to adopt the Living Wage for all of our employees and we encourage all other employers, public, private and third sector, to pay their staff the Living Wage.

"There can be no doubt about this Government's commitment to the principles of the Living Wage campaign.

"What we are debating today is how we use this Bill to further promote the Living Wage, not if we use it."

She said the First Minister had written to the European Commission on the issue, and was told making it a "contractual condition" to pay the Living Wage in public contracts was "unlikely" to meet current legal requirements.

The Deputy First Minister said the Government had "considered carefully" what could be done within the law, adding: "That's why the Bill allows ministers to issue statutory guidance on how workforce matters should be taken into account in procurement decisions. This can specifically deal with the Living Wage.

"That guidance will mean companies wishing to bid especially for service contracts where low pay has traditionally been an issue will have their approach to managing, rewarding and engaging with their workforce evaluated and that will include where it is relevant to the contract the willingness and the ability of bidders to pay the Living Wage."

She added that other changes would require public authorities to set out their policy on the Living Wage as part of their procurement strategies.

"Taken together that package of measures sends a very powerful message to businesses wanting to sell to Scotland's public sector," Ms Sturgeon said

"It says they will be expected to demonstrate their willingness and ability to pay the Living Wage and they will need to be able to demonstrate they're not winning contracts by undercutting competitors on the basis of a poorly paid workforce."

She added: "We are tackling this issue in the strongest way possible, and we will continue to do so."