Scottish scientists have been given cash backing to develop crucial elements of the successor to the Hubble telescope, which will be the most advanced window on distant galaxies in the history of space exploration.

The funding marks a remarkable milestone for the team at the UK Astronomy Technology Centre (UKATC) at the Royal Observatory in Edinburgh just months after the future of the facility was threatened by massive cuts.

The Blackford Hill team has been given the overall lead of the project for making the MIRI, one of three sophisticated cameras on board the James Webb space telescope.

It will allow scientists to see deeper into space and further back in time than ever before when it is launched with an Ariane 5 rocket from the spaceport in Kourou, French Guyana, in 2013.

It will be able to detect events closer to the Big Bang, explore galaxies and intergalactic gases that make up the large-scale structure of the universe, and reveal much more about how and when distant stars and planets were formed.

The UKATC forms part of a mission involving the European Space Agency, Nasa and the Canadian Space Agency.

Edinburgh's global position is already established in the field, with their expertise at work in observatories in Hawaii, Chile and Australia.

Nasa said the UKATC had been "extraordinarily successful" in attracting top talent to Edinburgh and in doing work "that excites the entire astronomical community".

The incredible move to almost halve the UKATC's £8m-a-year budget sparked a flurry of protest, and both Scottish Enterprise Minister Jim Mather and Edinburgh LibDem MP John Barratt wrote to London in protest.

But this week the UK funding body the Science and Technology Facilities Council announced a rethink.

The whole JWST project is costing approximately £1.5bn. The UK via STFC is spending £18.3m on MIRI.