Deep in the night sky, just 2.5 million light-years from Earth—practically our cosmic backyard—lies the Andromeda galaxy. You can spot it on a clear night away from city lights, a fuzzy patch that ancient stargazers noticed thousands of years ago. Now, astronomers using NASA's Hubble Space Telescope have uncovered a surprising story hidden in its stars: Andromeda, our nearest large galactic neighbor, may be running out of steam.

A new study published in The Astrophysical Journal reveals that star formation in Andromeda has been winding down for at least 500 million years. Even more dramatically, the pace has picked up in the last 40 million years, dropping to just one-fifth of its former rate. The researchers reached this conclusion by studying an astonishing 200 million individual stars using data from two Hubble surveys called the Panchromatic Hubble Andromeda Treasury and the Panchromatic Hubble Andromeda Southern Treasury.

"We need to measure the individual stars because they are the fossil record of the galaxy's formation," said Ben Williams, an astronomer at the University of Washington and a co-author of the study. "Hubble is the only telescope that can give you high enough spatial resolution over a large enough area to be able to do that in Andromeda."

The team divided Andromeda into thousands of small sections, each about 300 light-years wide, and pieced together the galaxy's history like detectives reading a diary. They calculated that roughly 500 million years ago, Andromeda was birthing new stars at a rate of about one solar mass—equal to the weight of our sun—every year. By 40 million years ago, that rate had fallen to about half a solar mass per year. Today, it's dropped to just one-fifth of a solar mass annually. That's like a busy factory slowly winding down operations.

The slowdown isn't spread evenly across the galaxy. Most of Andromeda's recent star formation has happened in a ring located about 32,000 light-years from the galaxy's center. Much of the decline the team measured comes from this region becoming less active. Rather than running out of cosmic gas and dust to build new stars, the galaxy seems to be naturally cooling off after a busy period.

"It's just like after running a marathon, sometimes you've got to take a bit of a breather," said Tobin Wainer, lead author of the study at the University of Washington.

Previous research had shown that Andromeda experienced a dramatic burst of star formation about 2 billion years ago, possibly triggered by a collision or near-collision with another galaxy. The current decline appears to be the aftermath of that ancient event.

The findings matter beyond just Andromeda. Because Andromeda is so close to us, scientists can study it in detail that would be impossible for more distant galaxies. What they learn there helps explain the history and future of our own Milky Way, which may one day experience a similar slowdown.

The team also explored a possible connection between Andromeda's declining activity and a small satellite galaxy called M32, located about 16,000 light-years away. They found hints that star formation near M32 decreased starting roughly 60 million years ago, which could help scientists figure out if and when M32 passed close to its much larger neighbor.