Apollo 11 is rightfully hailed as an extraordinary success for the US. After all, NASA rocketed humans to the moon's surface for the first time and brought them home alive.

But there were quite a few close calls during the historic mission that could have ended it in tragedy.

Minutes ahead of the moon landing, for instance, alarms blared inside the lunar-landing spacecraft, indicating that the flight computer was overloaded and might quit. Then a surprise crater threatened to botch the landing, so Neil Armstrong and Buzz Aldrin (the two moonwalkers) used up nearly all of their fuel navigating to safer lunar pastures.

These and other stories — frozen fuel lines, a stuck hatch, a busted switch required to leave the moon — are well-shared among spaceflight enthusiasts and historians.

But according to a forthcoming book, the mission's three astronauts may have been in far more peril than previously reported.

A serious anomaly occurred as the crew careened toward a landing on Earth, according to Nancy Atkinson, a science journalist and author who details formerly classified information about the event in her new book, "Eight Years to the Moon: The History of the Apollo Missions."

"Through my interviews and research for the book, I uncovered a serious anomaly that occurred during Apollo 11's return to Earth," Atkinson — whose book comes out July 2 — told Business Insider in an email. "The event was discovered only after the crew had returned safely to Earth."

The problem happened just before Apollo 11 returned to Earth, causing a discarded space module to nearly crash into the crew's capsule.

What's more, Atkinson's sources suggest, the same issue also threatened the crews of three other Apollo missions.

'We were lucky'

The main spacecraft that NASA used during the Apollo moon-landing program. Astronauts left the lunar module on the moon, broke away from the service module during landing, and splashed into the ocean inside the command module. NASA; Business Insider

The anomaly happened less than an hour before the Apollo 11 crew landed. As Atkinson tells it, most everyone at NASA did not realize the peril it put astronauts in until weeks after they'd returned to Earth.

For most of their eight-day mission, the crew of Apollo 11 rode inside a gumdrop-shaped capsule called the command module. This capsule sat on top of the service module: a large cylinder that carried supplies, propellants, and a large rocket engine. NASA called the two-part spacecraft the command and service module, or CSM.

The CSM delivered a third part, called the lunar module, to lunar orbit. Then that lander took Aldrin and Armstrong to and from the surface, while astronaut Michael Collins remained in orbit around the moon. The CSM then rocketed everyone back toward Earth on a three-day voyage.

About 15 minutes before the astronauts splashed into the Pacific Ocean, the CSM fully separated into its two parts. This was necessary because only the command module (which held the crew) had a heat shield. The heat shield protected the astronauts by deflecting and absorbing the scorching energies created by plowing through Earth's atmosphere at about 25,000 mph — more than a dozen times as fast as a speeding bullet.

A line drawing illustrating the Apollo 14 Command and Service Modules changes following the Apollo 13 near-disaster. NASA The service module became useless and posed a collision risk after the two parts separated, so it was supposed to skip off Earth's atmosphere like a stone thrown across a pond.

But it did not.

Read more: An Apollo astronaut explains how he nearly killed himself 'horsing around' on the moon in 1972

Instead, as Atkinson explains, the service module chased the astronauts during their descent.

"Houston, we got the service module going by. A little high and a little bit to the right," Aldrin, who was looking out of the command module's window, told Mission Control over the radio.

Moments later he added: "It's coming across now from right to left."

As plasma built up ahead of the capsule, its radio communications temporarily went out (as expected) yet prevented the astronauts from offering any more details. But an airplane pilot spotted the returning command module and service module, the latter of which was breaking apart and splintering into glowing pieces.

Gary Johnson, who worked as an electrical engineer on the Apollo program, told Atkinson that the service module should have been "absolutely nowhere close to the command module" as it descended.

If the part had collided with the command module carrying the astronauts, it could have crippled or destroyed the vehicle or sent it flying out of control. Chunks of the disintegrating service module could also have struck the capsule, which could have led to catastrophe as well, Atkinson wrote.

"If things had gone bad, we could have lost the Apollo 11 crew," Johnson told Atkinson. "We were lucky."

Why the Apollo jettison anomaly isn't well known

Apollo 11's command module and service module careen back to Earth at thousands of miles per hour, creating superheated plasma in the process, on July 24, 1969. Most of the lights are pieces of the disintegrating service module. NASA/JSC via Smithsonian Institution

The astronauts, mission controllers, and communications personnel didn't understand there was a problem until after NASA debriefed the three moon men about their mission weeks later.

NASA launched an investigation based on their reports and found that two prior missions — Apollo 8 and Apollo 10 — had suffered the same glitch. Those astronauts did not see the service module outside their windows, however, so they didn't report it, Atkinson wrote. (A review of old radar recordings showed the service modules on those missions did also fly dangerously close to the command modules, though.)

The problem's cause turned out to be a bad sequence in a controller that helped jettison, or separate, the command and service modules. NASA knew the same problem was baked into the Apollo 12 spacecraft, which launched in November 1969, but decided not to fix it due to time constraints, Atkinson said.

According to Johnson, NASA kept the Apollo 11 astronaut debriefs classified for some time. An official report about the anomaly came out in November 1970 — about six months after the harrowing Apollo 13 mission — and somehow managed to stay out of newspapers.

"The event never made it into the Apollo 11 mission reports and somehow was largely forgotten — I think due to the frantic-ness of the time, of needing to move on to the next flight, etc.," Atkinson said. "The first time the fix for this anomaly was in place was for Apollo 13. And of course, you know what happened with 13, and I think the anomaly was probably largely forgotten due to all the other excitement."

More details about the anomaly can be found in Atkinson's book.

This story has been updated.