“Black in Space: Breaking the Color Barrier,” scheduled to air Monday on the Smithsonian Channel, examines how black astronauts raced into the heavens while fighting for human rights on Earth.

It shows how the astronauts surmounted racist barriers and hostile commanders to get close to the stars.

“They really are the first of the first,” filmmaker Laurens Grant said. “And they are the elite of the elite.”

Not only did these aspiring space travelers have to navigate the racist politics of their time, they also had to study cutting-edge science and engineering to compete with others, Grant said.

And it didn’t always end happily.

The road to get black astronauts into space in the U.S. began under President John. F. Kennedy.

His brother Attorney General Robert Kennedy pressured an Air Force program to make sure its astronaut project had a person of color.

The life journeys of black astronauts are shared in the new documentary that looks at the final frontier of civil rights: getting black astronauts into space amid Jim Crow, danger, discrimination and the Cold War.

NASA ASTRONAUTS WILL RETURN TO SPACE FROM US SOIL 'BEFORE SUMMER': PENCE

Within four generations, they went from slavery to space.

The film shows how the former Soviet Union beat the U.S. and sent into space Cuban cosmonaut Arnaldo Tamayo Méndez.

He was the first Latin American and first person of African descent to reach space.

After his mission, he became a Cold War hero for Cuba — and his accomplishment was largely ignored.

Here is the story of five visionary Americans:

RONALD MCNAIR

In this Jan. 27, 1986, file photo, the crew for the Space Shuttle Challenger flight 51-L leaves their quarters for the launch pad at the Kennedy Space Center in Florida. Mission Spl. Ronald McNair, center, was only the second African American chosen to go to space. He died in the Challenger launch. (AP Photo/Steve Helber, File)

In this Jan. 27, 1986, file photo, the crew for the Space Shuttle Challenger flight 51-L leaves their quarters for the launch pad at the Kennedy Space Center in Florida. Mission Spl. Ronald McNair, center, was only the second African American chosen to go to space. He died in the Challenger launch. (AP Photo/Steve Helber, File)

In 1959, Ronald Erwin McNair walked into a South Carolina library.

The 9-year-old aspiring astronaut wanted to check out a calculus book, but a librarian threatened to call the police if he didn’t leave.

McNair was black.

Years later, McNair was selected to become only the second African American to travel to space, overcoming segregation, poverty and racist hidebound stereotypes in an intellectual act of resistance that inspired a generation.

Tragically, McNair died in the 1986 Space Shuttle Challenger tragedy.

ED DWIGHT

Air Force Capt. Ed Dwight was selected for a trainee program and became an overnight hero in the black press.

However, the NASA program did not select him for the astronaut program.

ROBERT LAWRENCE

FILE - In this June 30, 1967, file photo, Maj. Robert H. Lawrence Jr., the first black astronaut in the U.S. space program, is introduced at a news conference in El Segundo, Calif. (AP Photo, File)

FILE - In this June 30, 1967, file photo, Maj. Robert H. Lawrence Jr., the first black astronaut in the U.S. space program, is introduced at a news conference in El Segundo, Calif. (AP Photo, File)

U.S. Air Force officer Robert Henry Lawrence Jr. was chosen instead.

The U.S. Air Force selected the Chicago-born Lawrence as the first African-American astronaut, and he may have made it to the moon.

Unfortunately, Lawrence died after his F-104 Starfighter crashed in 1967 at Edwards Air Force Base in California.

No African Americans would make it to the moon.

FREDERICK GREGORY

FILE - In this June 22, 2004, file photo, Deputy Administrator of NASA Frederick D. Gregory, left, talks as Deputy Assistant Secretary for Science Lee M. E. Morin, looks on at a news conference at the India-United States Conference on Space Science, Applications and Commerce in Bangalore, India. (AP Photo/Gautam Singh, File)

FILE - In this June 22, 2004, file photo, Deputy Administrator of NASA Frederick D. Gregory, left, talks as Deputy Assistant Secretary for Science Lee M. E. Morin, looks on at a news conference at the India-United States Conference on Space Science, Applications and Commerce in Bangalore, India. (AP Photo/Gautam Singh, File)

During the Space Race era, Star Trek Communication Officer Lieutenant Uhura, played by Nichelle Nichols in the 1960s NBC television series, got the closest to space, even though she was a fictional character.

Nichols would later speak out in public service announcements to recruit black scientists and pilots to NASA.

 Frederick Gregory, now 79, saw some of those ads.

“She was inside my TV one morning. She pointed at me and said, ‘I want you to apply for the NASA program,’” Gregory said. “She was talking to me.”

The U.S. Air Force pilot would apply and later become the first African-American shuttle pilot.

GUION BLUFORD

In this Sept. 5, 1983, file photo, Guion Bluford, Jr., shuttle Challenger mission specialist, is shown in portrait on returning to the Johnson Space Center in Houston, Texas. (AP photo, File)

In this Sept. 5, 1983, file photo, Guion Bluford, Jr., shuttle Challenger mission specialist, is shown in portrait on returning to the Johnson Space Center in Houston, Texas. (AP photo, File)

Guion Bluford would become the first African-American astronaut to go to space. The aerospace engineer made it to space in 1983 as a member of the crew of the Orbiter Challenger.

His trip came nearly 20 years after Kennedy sought to get a black man in space.

PROGRESS

Gregory said he’s proud of his role in breaking barriers and contributing to space exploration.

However, he’s now concerned about what comes next.

CLICK HERE TO GET THE FOX NEWS APP

In an interview with The Associated Press, Gregory said he recalls looking down at Earth while floating in space and traveling at high speed.

“Your concept of neighbor changes significantly,” Gregory said. “I began saying, ‘Hey, this is a world, and we are all part of it.’ When you go to space, you don’t see boundaries on the ground. You wonder, why do these people dislike each other. Your concept of what your home is changes.”

The Associated Press contributed to this report.