Image copyright NASA Image caption Hubble has been operational for 28 years

Nasa believes it has fixed a malfunction with the Hubble telescope which threatened to limit the orbiting observatory's performance.

Earlier this month, one of Hubble's gyros - needed to point the spacecraft - failed, forcing controllers to place the telescope in "safe mode" - where it operates with essential functions only.

This was required because a backup gyro also malfunctioned when switched on.

But after a series of tests, the backup appears to be working normally.

The telescope, launched in 1990, has been described as one of the most important scientific instruments ever created.

Hubble telescope hit by mechanical failure

A gyroscope is a device that measures the speed at which the spacecraft is turning, and is needed to help Hubble turn and lock on to new targets. It consists of a wheel inside a sealed cylinder - called a float - which is suspended in thick fluid.

There were originally six gyros; the observatory had been operating on four until the problem about two weeks ago. At any given time, Hubble needs three gyroscopes to work for optimal efficiency.

The failure of a another gyro, and the discovery that a backup was faulty left Hubble with only two fully functional gyros.

This could have forced controllers to operate the telescope on just one, to extend the lifetimes of both components for as long as possible.

At the time, the deputy mission head for Hubble, Rachel Osten, said: "The plan has always been to drop to 1-gyro mode when two remain. There isn't much difference between 2 and 1, and it buys lots of extra observing time, which the astro community wants desperately."

Image copyright nASA/ESA/hubble Heritage Team Image caption There is great demand from astronomers to use Hubble

Hubble is prized by the astronomical community, and observing time has to be carefully managed because of the high demand.

Astronomer Prof Nial Tanvir, from Leicester University, told the BBC that Hubble could have continued to operate with relatively little impact on one gyro.

But this mode would probably have placed limitations on which part of the sky Hubble could observe at any one time. It might also have taken the telescope longer to move from observing one target to another.

Nasa said the malfunctioning backup gyro - which had been turned off for 7.5 years - had been showing "extremely high rotation rates".

In an attempt to correct the problem, the Hubble operations team performed a running restart of the gyro on 16 October.

Image copyright NASA Image caption The James Webb Space Telescope will launch no earlier than 2021

This procedure turned the gyro off for one second, and then restarted it before the spinning wheel inside the gyro slowed down.

However, controllers saw no improvement.

Two days later, the operations team commanded the spacecraft to make a series of manoeuvres. This was designed to dislodge any blockages within the gyro itself.

In a statement, Nasa said that on 19 October, "the operations team commanded Hubble to perform additional manoeuvres and gyro mode switches, which appear to have cleared the issue".

It added: "Hubble then executed additional manoeuvres to make sure that the gyro remained stable within operational limits as the spacecraft moved. The team saw no problems and continued to observe the gyro through the weekend to ensure that it remained stable."

The James Webb Space Telescope (JWST) is Hubble's designated successor, but it has experienced a series of delays and will not launch until 2021, at the earliest.

Astronomers have recently been talking about how they can extend Hubble's life so that it could continue to serve the astronomy community.

Follow Paul on Twitter.