The BlindCraft factory in Edinburgh has been saved after city councillors agreed it could move to a three-day-week.
It means the plant can stay open while making savings of £700,000 a year.
Officials had recommended the loss-making plant should be closed but a last-minute deal has now been reached.
The 57 staff, who are mostly disabled, are employed by the council-funded charity to make mattresses. It has been operating in Edinburgh since 1793.
The Craigmillar factory will now run on a three-day week.
'Strength to strength'
Steve Cardownie, Edinburgh City Council's deputy leader, said: "It's going to stay open. We are going to transfer operations from the health and social care budget to economic development and that is a business department so it should operate properly as a business.
"Then hopefully we will make inroads into the marketing area and make sure it goes from strength to strength.
"We are looking for a saving of £700,000 per year and a three-day-week gives us a saving of £650,000 a year so it would be a folly to turn down the compromise.
"It will be hard work to make sure it does work but we hope we can make a success of it."
Watty Weir, of Unison, said: "If you put these people on a three-day-week who is going to start looking for the wages and income for the following two days?
"They will be fired onto a scrapheap, no other employer will take them on."
Jim Mather, Enterprise Minister said: "This is welcome news for Blindcraft and for all those connected with this worthwhile and well-established organisation, particularly for the people whose jobs will be saved.
"The Scottish government was pleased to facilitate discussions with the City of Edinburgh Council and Blindcraft's stakeholders, and we welcome the council's decision."