It was conceived when Ronald Reagan was in the White House. It launched a few weeks after Mark Zuckerberg created Facebook in his Harvard dorm. It spent a full decade looping around the solar system. And when it finally caught up with its target, it deployed the first probe to land on a speeding comet and survive.

Now the long, dramatic journey of the Rosetta space orbiter is about to end. After logging 4.9 billion miles, the craft is set to commit operational suicide in the wee hours of Friday morning, deliberately falling to the surface of 67P/Churyumov-Gerasimenko, the mountain-sized comet it has been following for the past two years.

But first it has just a bit more science to do.

During its final descent, Rosetta will gather close-range information about the comet and hastily beam data back to Earth before its main transmitter shuts off for good.

“It’s kind of bittersweet,” said Paul Weissman, a comet scientist at the Planetary Science Institute in Tucson, Ariz., who worked on Rosetta for 20 years. “You’d like to keep going, but it is also very satisfying. It’s been a tremendously successful mission.”

The $1 billion mission has been full of suspense.

Its many plot twists began before the spacecraft left Earth, when a faulty rocket postponed the launch by two years and caused mission planners at the European Space Agency to abandon their original comet and select a different one instead. The new comet, known as 67P, was four times larger than the initial target, and meeting up with it required a longer flight than originally planned – from March 2004 to January 2014.

As Rosetta closed in on its target, researchers were dazzled by the strange and unexpected shape that gradually came into focus. The comet was roughly 2.5 miles across and had two distinct lobes that resembled a rubber duck with a head, thin neck and bulbous body. In time, Rosetta’s instruments revealed a dramatic world of towering cliffs, deep pits and massive boulders.

“It was a big surprise,” said Claire Vallat, a scientist at the agency’s European Space Astronomy Center.

Rosetta continued to orbit the comet as it made its closest approach to the sun in August 2015. From a safe distance of 186 miles, it watched as 67P became more active, with streams of dust and gas shooting off its surface. The comet’s display subsided as it flew further from the sun.

“Rosetta had a major goal in mind, which was to rendezvous with a comet far from the sun and watch it wake up and then let it die down again,” said Laurence O’Rourke, a lander systems engineer at ESA. “Overwhelmingly, we have met that goal.”

Now Rosetta has reached the end of its journey. Comet 67P is on its way toward the orbit of Jupiter, and soon Rosetta’s 100-foot solar panels will be too far from the sun for the spacecraft to function.

Although the last few minutes of its life are difficult to predict, researchers expect it to hit 67P at a walking pace of slightly less than 3 feet per second. When it lands, it will tumble and bounce before settling into its final resting place on the small lobe of the comet. The impact will kick up a few clouds of dark, powdery dust. Then a preprogrammed computer command will turn off its transmitters forever.

Here on Earth, hundreds of scientists and engineers will gather at the European Space Operations Center in Darmstadt, Germany, to watch for the flattening of the radio signal that will let them know Rosetta has gone offline forever.