The right of council tenants to buy the homes they rent at discounted rates will be abolished in Scotland.
Deputy First Minister Nicola Sturgeon confirmed the government's decision to end the scheme on a visit to a housing association in Glasgow.
Margaret Thatcher's Tory government introduced the scheme in 1980.
The Scottish government has already scrapped "right to buy" for new tenants and it will be abolished altogether in 2017.
Since the opportunity to buy was introduced, 455,000 Scottish properties have been sold.
The Scottish government said that had reduced the number of homes available for cheap rent and increased the waiting lists for properties of this type.
Ms Sturgeon, during a visit to Queens Cross Housing Association, said the move would "safeguard social housing stock for future generations".
She added: "It is absolutely vital that people can access social housing when they need it most. Social housing is under significant pressure and so too are the budgets that support it.
"The Scottish government is doing everything possible to maximise our investment in housing and deliver on our target of 30,000 new, affordable homes over the lifetime of this parliament.
"But, given the pressure on both the housing stock and budgets - and with 400,000 people on waiting lists for social housing - we can no longer afford to see badly needed homes lost to the social sector."
In November last year, a Scottish government consultation revealed that a majority of Scottish councils wanted the right to buy policy scrapped.
The report also showed that many tenants and social landlords wanted it to end.
An opponent of the move is former Scottish Conservative Party leader Annabel Goldie.
She told BBC Radio Scotland's Good Morning Scotland programme that the policy was "arguably" one of the most "socially liberating" policies to be introduced in Scotland and across the UK.
Miss Goldie added: "I can still remember the days when people lived in monolithic council house schemes - that is what they were called - and they were afflicted by a postcode prejudice.
"They were apprehensive about disclosing their address because they felt it would negate their chance of getting a job or even being accepted for an interview.
"By offering a tenant the right to buy, you did two things - you first of all introduced a freedom to the individual to make a choice about how they wanted to live, and secondly you stopped them being trapped in that environment - because that is exactly what they were."
She went on: "Right to buy freed people from the environmental prison they were in."
The Scottish Federation of Housing Associations welcomed the Scottish government's announcement.
Its membership manager said: "Right to buy has had its day and has no place in 21st century Scotland.
"It has been beneficial to a relatively small number of individuals, but clearly a loss to the greater public good. Half a million social rented homes have been lost in the 30 years of this policy in Scotland, very often the better stock in the more popular areas."
Although the right to buy policy will come to an end in Scotland in 2017, it continues to exist elsewhere in the UK.
- In England the right to buy has been extended, with discounts of up to £75,000 outside London and £100,000 in the capital. In addition, the occupancy period before tenants can apply to buy has been reduced from five years to three years.
- In Wales the maximum discount available is £16,000 and the qualifying period for tenants is five years. In 2010 the Welsh Assembly gained the power to suspend the policy, but has not done so.
- In Northern Ireland, the qualifying period for tenants is five years and the maximum discount available is £24,000.