Japan has given up on its first interplanetary space mission on the final leg of the journey to Mars.
Nozomi: The mission has lasted five years and five months
Officials have decided not to put the Nozomi space craft into orbit around the planet.
Last-ditch attempts to fix an onboard electrical fault have failed, and the probe will be steered off into space.
This will stop Nozomi crashing into Mars and possibly contaminating its environment, which may once have harboured life - and perhaps still does.
The Japan Aerospace Exploration Agency said a final attempt was made on Tuesday to remotely repair electronic circuitry on the Nozomi probe.
"But we failed to fix the short-circuit in the electric system and, as the result, we gave up the plan to place Nozomi into orbit around Mars," said researcher Yasunori Matogawa.
A spokesman for the Embassy of Japan in the UK confirmed that the mission had been aborted.
Nozomi will now be directed away from Mars to stop it crashing into the planet.
It will probably end up circling the Sun somewhere beyond the fourth planet. But the agency has not lost all hope of getting something out of the mission.
Engineers will continue trying to fix the circuit so that they can use the probe for other space observations.
Nozomi, which means "hope" in Japanese, was launched in July 1998 and should have arrived at Mars the following autumn.
But it has been dogged by technical problems since soon after take off. A technical fault left Nozomi low on fuel and its flight path had to be radically altered to get it to the Red Planet.
Two fly-bys around the Earth put it back on track, but the craft was exposed to a solar flare that damaged its electrical systems.
The abandonment of the Mars mission is the latest setback for Japan's space programme.
Last month, it was forced to destroy a rocket carrying two spy satellites intended to monitor North Korea.
Officials said the rocket had to be destroyed after take-off because of an unspecified technical failure.
It came just weeks after China's recent success in sending an astronaut into space.