The Scottish parliament is on course to introduce the world’s most comprehensive provision of free period products after the SNP government announced it would support a “groundbreaking” bill brought by a Labour MSP.

The legislation would place a legal duty on the Scottish government to develop a universal scheme for free period products such as tampons and sanitary towels. Schools, colleges and universities would have to provide the products for free in their toilet facilities and Scottish ministers could also call on other public service bodies to do likewise.

The period poverty campaigner Monica Lennon, the Scottish Labour MSP who brought the motion, said the SNP’s move to join in the cross-Holyrood support for the bill was “a victory for all of the campaigners and activists who have backed this legislation”.

The Scottish government had initially challenged the universal provision proposed by the bill, with the communities secretary, Aileen Campbell, suggesting it was open to abuse and could lead to people crossing the border to pick up large quantities of tampons for free for themselves or to sell on.

The Scottish government also disputed the costings in the bill: while Lennon took her £9.7m a year estimate from an ongoing pilot scheme in Aberdeen, the SNP estimates that a universal scheme could cost about £24m a year to deliver.

But with the Scottish Conservatives, Greens and Lib Dems committed to supporting the bill, the SNP was set to be the only party opposing it at its crucial stage one debate next Tuesday. It was an uncomfortable position for a government that has led on period poverty.

The first minister, Nicola Sturgeon, has supported access to period products for those on low incomes, announcing in 2017 that a scheme to provide free sanitary products would be provided in schools, colleges and universities, a world first.

The SNP was also facing growing pressure from its own activists as well as from a broad coalition of trade unions and civic society groups galvanised by Lennon.

Announcing the switch to back the bill, Campbell said she still had “significant and very real concerns about the practicality and deliverability of the bill in its current form”, but said the Scottish government was supporting the legislation at this stage “as a signal of our good faith and in recognition of the broad consensus about general policy objectives”.

She urged other parties to work together “in the same constructive spirit” in order to reach agreement at the amendment stage, which will include discussions of the practicalities of implementing the universal scheme, and on the financial instrument required to facilitate the bill.

Lennon said: “Scotland has already taken important steps towards improving access to period products and tackling stigma. Legislation will guarantee rights, ensure that current initiatives continue in future on a universal basis, and will help us achieve period dignity for all.

“We have the opportunity to make a lasting difference and I hope every MSP will back the bill at stage one and continue to listen to those who would benefit from this groundbreaking legislation.”

Patrick Harvie, co-convenor of the Scottish Greens, welcomed the announcement, saying: “This is the result of hard work by Monica Lennon as well as many civil society organisations and genuinely cross-party grassroots activist pressure. There may be proposals to amend and improve the bill, but at least now we’ll get the opportunity to debate them.”