Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A volatile double star system appears to change its behavior rapidly and unpredictably like a cosmic story of Dr. Jekyll and Mr. Hyde.

This stellar duo, known as Terzan 5 CX1, lies roughly 19,000 light-years from Earth in a dense collection of stars, or globular cluster, called Terzan 5. The pair consists of a neutron star — an extremely dense remnant of a supernova explosion — and a smaller, sunlike star.

Using NASA's Chandra X-ray Observatory and the National Science Foundation's Karl F. Jansky Very Large Array (VLA), astronomers found that this binary star system switches between two alter egos every few years.

Video: Double star system is a 'cosmic Jekyll and Hyde'

Related: Is life possible around binary stars? (Podcast)

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Data collected from more than a decade of observations show that the neutron star closely orbits its lower-mass stellar companion. The heavier neutron star pulls material from its partner into a surrounding accretion disk, which emits bright X-ray light detected by Chandra.

At this stage, the stellar duo is referred to as a low-mass X-ray binary. However, as orbiting material in the accretion disk spirals toward the neutron star, it rotates faster and transforms into what is known as a millisecond pulsar star, which emits pulses of radio waves detected by the VLA. After a few years, the stellar duo appears to return to its original state.

"The neutron star can spin faster and faster until the roughly 10-mile-wide sphere, packed with more mass than the sun, is rotating hundreds of times per second," NASA officials said in a statement. "Eventually, the transfer of matter slows down and the remaining material is swept away by the whirling magnetic field of the neutron star, which becomes a millisecond pulsar."

The data revealed that the stars' behavior changed over the course of only a couple years. Chandra observations from 2003 captured bright X-ray emissions, indicating that Terzan 5 CX1 was behaving like a low-mass X-ray binary.

However, Chandra data taken from 2009 to 2014 show that Terzan 5 CX1 was 10 times fainter in X-rays. Meanwhile, the VLA also recorded radio waves from Terzan 5 CX1 in 2012 and 2014, suggesting the stellar duo transformed into a millisecond pulsar and was blowing material out into space.

When Chandra observed Terzan 5 CX1 again in 2016, the stars had already returned to behaving like a low-mass X-ray binary, emitting brighter X-rays. This type of behavior is rarely seen in binary star systems. Typically it takes several billion years for a low-mass X-ray binary to evolve into a millisecond pulsar, according to the statement.

Additional observations using both the Chandra X-ray Observatory and VLA are needed to confirm the pattern of "Jekyll and Hyde" behavior exhibited by Terzan 5 CX1. Studying this binary system provides insight on identity-changing stars, as only three have been identified to date.

Follow Samantha Mathewson @Sam_Ashley13. Follow us on Twitter @Spacedotcom and on Facebook.