Britain needs seven million migrants over the next 50 years to help keep down national debt levels, according to the official forecaster.
The Office for Budget Responsibility (OBR) warned the UK's ageing population was squeezing public finances and said there was "clear evidence" that migrants, who tend to be working age, have a "positive effect on the public sector's debt dynamics".
Increasing pensioner numbers and a strained healthcare system means an extra £19bn (€21.9bn) of spending cuts or tax hikes are needed to combat an "unsustainable" pressure on the nation's public finances short term, according to the organisation.
It said the British government would need to find the additional savings in the year to April 2019 on top of the current £153bn (€176.6bn) in austerity measures to get debt down to 40% of economic output.
If no action is taken, the burden of an ageing population in terms of pensions and healthcare will wipe out much of UK Chancellor George Osborne's spending cuts, leaving the UK with a £65bn (€75bn) hole in its finances, according to the OBR.
In its annual fiscal sustainability report, it said: "It is clear that longer-term spending pressures, if unaddressed, would put the public finances on an unsustainable path."
"Public sector net debt would approach 100% of gross domestic product (GDP) and still be rising," it added.
The report predicts, however, that the debt would be nearly double that without net migration to improve public finances.
Under an annual flow of 140,000 migrants from 2016 the public sector net debt to GDP ratio would reach 99% by 2063 but that would soar to 174% if there was a complete block on immigration.
The OBR report adds: "Our sensitivity analysis shows that overall migration has a positive impact on the sustainability of the public finances over our 50 year horizon.
"Under our central assumption of 140,000 annual net inward migration from 2016 the public sector net debt to GDP ratio reaches 99% by 2062-63, while assuming zero gross migration increases the net debt to GDP ratio to over 174%.
"These results are driven by the assumed age structure of net migration, which tends to be more concentrated in the working age group and hence reduces the dependency ratio throughout the projection period."
The OBR said the move to a single-tier state pension had slightly eased the pressure on public sector debt, but added that spending on healthcare was the biggest spending pressure over the next 50 years.
It said the cost of the state pension was predicted to rise from 5.8% of GDP to 8.4% of GDP as the population ages, even with the introduction of the new flat rate payment system and increase in retirement age to 67 taken into account.
Healthcare spending is expected to increase from 7% of GDP to 8.8% of GDP, while long-term social care costs are set to rise from 1.3% of GDP to 2.4% of GDP.
The OBR also warned that declining North Sea oil reserves will take its toll, with oil and gas revenues expected to plunge from 0.4% of GDP now to almost negligible levels - at 0.03% of GDP by 2040.
But action taken so far by the British government, including an extra year of spending cuts to 2017-18 and the single tier state pension, is helping to offset some of the pressures, the report added.
Robert Chote, chairman of the OBR, said on presenting the report: "Since last year, the underlying deficit and debt path look less favourable.
"But this and the costs of long-term care reform are likely to be offset by the Government's announcement of additional spending cuts in 2017-18 and savings from the single tier pension.
"That said, there are huge uncertainties around the scale of the challenge and the UK is certainly not alone in confronting it."
He added that the extra £19bn needed to get borrowing back on track could be spread over the next 50 years rather than action taken in one go.
In a written statement, British Chief Secretary to the Treasury Danny Alexander said the OBR's report shows that without the steps taken over the past year, public borrowing would be around 50% of GDP higher in 50 years' time.
He added that the report identifies the extra spending cuts as "one of the key factors in containing the growth of spending over the long-term, demonstrating the importance of the Government's programme of fiscal consolidation for the long-term health of the public finances".
The OBR said Mr Osborne was shown a draft copy of the report in early July and had not revealed any further measures that should be taken into account.