Astronomers have used NASA’s Kepler space telescope to capture for the first time the incredible flash from an exploding star’s shockwave.

The shockwave, known as the “shock breakout”, was identified by a team led by Peter Garnavich, an astrophysics professor at the University of Notre Dame in Indiana. The scientists analyzed light captured by Kepler every 30 minutes over a three-year period from 500 distant galaxies, searching some 50 trillion stars, according to a NASA statement.

Two of the massive stars, called red supergiants, exploded while in Kepler’s view in 2011. One of the stars, KSN 2011a, which is 700 million light years from Earth, is nearly 300 times the size of the sun. The second star, KSN 2011d, is approximately 500 times the size of sun and around 1.2 billion light years away.

Related: Buzz Aldrin eyes 2040 for manned Mars mission

A light year measures the astronomical distance that light travels in one year and is equivalent to 5.8 trillion miles.

 “In order to see something that happens on timescales of minutes, like a shock breakout, you want to have a camera continuously monitoring the sky,” said Garnavich, in the NASA statement. “You don’t know when a supernova is going to go off, and Kepler's vigilance allowed us to be a witness as the explosion began.”

NASA explained that supernovae like the ones observed by Kepler, which are known as Type II, begin when the internal furnace of a star runs out of nuclear fuel, causing its core to collapse as gravity takes over.

Related: Sign of alien life? Kepler telescope spots strange star

The agency noted that there was no shock breakout from the smaller supergiant’s explosion, possibly because it was surrounded by gas, which may have masked the shockwave when it reached the star's surface.

Supernovae can provide great scientific insight into our own Milky Way galaxy.

"All heavy elements in the universe come from supernova explosions. For example, all the silver, nickel, and copper in the earth and even in our bodies came from the explosive death throes of stars," explained Steve Howell, project scientist for NASA's Kepler and K2 missions at NASA’s Ames Research Center in California's Silicon Valley, in NASA’s statement. "Life exists because of supernovae."

Related: NASA’s Kepler mission discovers Earth’s older, bigger cousin

Last year NASA’s Kepler mission discovered Kepler-452b, the first near-Earth-size planet in the “habitable zone” around a sun-like star.

Also in 2015, a citizen science program at Yale University used Kepler data to discover the star KIC 8462852, which is 1,481 light years away from Earth.

NASA's Kepler spacecraft was launched in 2009. The mission's objective is to explore the structure and diversity of planetary systems.