Two days after a successful launch from California, SpaceX fired off another Falcon 9 rocket from Cape Canaveral Wednesday, this one carrying a Dragon cargo ship loaded with 5,660 pounds of equipment and supplies bound for the International Space Station.

But an attempt to recover the booster's first stage ended in failure when a hydraulic system malfunction caused the booster to rapidly spin and tilt about its long axis during its final descent. As a result, the rocket landed well off target, settling to a gentle, upright "landing" in the Atlantic Ocean just east of the launch site.

The rocket then tilted over, splashing down horizontally and remaining intact. SpaceX founder Elon Musk tweeted that the hydraulic problem affected the movement of the rocket's four titanium "grid fins," used for steering and to maintain orientation as the booster drops tail first back to Earth.

Get Breaking News Delivered to Your Inbox

"Pump is single string," Musk tweeted, meaning the system does not have a backup. "Some landing systems are not redundant, as landing is considered ground safety critical, but not mission critical. Given this event, we will likely add a backup pump & lines."

A few minutes later, he tweeted video captured by a camera on board the rocket. "Engines stabilized rocket spin just in time, enabling an intact landing in water! Ships en route to rescue Falcon," he said.

Engines stabilized rocket spin just in time, enabling an intact landing in water! Ships en route to rescue Falcon. pic.twitter.com/O3h8eCgGJ7 — Elon Musk (@elonmusk) December 5, 2018

It was SpaceX's sixth outright landing failure and the first since June 2016, ending a string of 27 successful recoveries. The company's overall record stands at 32 successful recoveries: 11 at the Cape Canaveral Air Force Station, one at Vandenberg Air Force Base in California and 20 on off-shore droneships.

Video posted on YouTube shows the booster dropping back down to Earth and then tilting over.

The new "block 5" Falcon 9 stages are designed fly dozens of times with minimal refurbishment between launchings, a key element in the company's drive to lower launch costs by recovering and re-flying recovered stages.

The stage launched Monday from California was making its third flight, a first for SpaceX. But the rocket launched Wednesday from Cape Canaveral was brand new. It's not yet clear what went wrong with the grid fin or whether the mishap will prompt the Air Force to reconsider SpaceX's clearance to land at the Air Force station.

But the landing system is designed with the safety of personnel and ground facilities in mind. The rocket's guidance system initially targets an off-shore "impact point" and only moves the target on shore to the landing pad during a final rocket firing and only after verifying all systems are operating properly.

During Wednesday's landing, the flight computer recognized the grid fin problem and never moved the impact point ashore during the final engine firing.

"The important point here is we have a safety function on board that makes sure the vehicle does not go on land until everything is OK, and that worked perfectly," Hans Koenisgman, SpacerX vice president of build and flight reliability, told reporters. "The vehicle kept well away from anything where it could pose even the slightest risk to population or property.

"Public safety was well protected here," he added. "As much as we are disappointed in this landing, or landing in the water, it shows the system overall knows how to recover from certain malfunctions."

The mission got underway at 1:16 p.m. EST (GMT-5) when the Falcon 9's nine Merlin 1C engines ignited with a roar and a torrent of fiery exhaust, quickly pushing the 230-foot-tall booster away from launch complex 40 at the Cape Canaveral Air Force Station.

Liftoff came a day late because of time needed to replace moldy food bars in a habitat housing 40 rodents being carried to the station for medical research. But it was clear sailing Wednesday and the countdown ticked to zero with no interruptions.

At the moment of liftoff, the space station was flying 250 miles above the Indian Ocean south of Australia, but the plane of its orbit was sweeping across the Cape Canaveral Air Force Station as Earth rotated below it. The Falcon 9 climbed away to the northeast directly into that orbital plane to enable the planned rendezvous.

A split-screen view shows Cape Canaveral, left, as seen by a camera mounted on the Falcon 9's first stage. Moments later, the rocket appeared to spin out of control before setting down in the Atlantic Ocean just east of the launch site. The right-side frame shows the view from the Falcon 9's second stage as it continued toward orbit, with the Florida peninsula visible in the distance. SpaceX

The first stage engines shut down and the lower section of the rocket fell away two minutes and 23 seconds after liftoff. The single engine powering the second stage then ignited for a six-minute 18-second burn to complete the climb to orbit.

The first stage, meanwhile, flipped around and restarted three engines to reverse course and head back toward Florida. Another burn four minutes later slowed the stage down for descent back into the thick lower atmosphere.

Long-range tracking cameras provided spectacular views as the stage dropped tail first toward Cape Canaveral. But television views from a camera mounted on the rocket suddenly showed it rotating roughly about it's long axis.

The rocket's center engine started as usual for landing, and the booster's landing legs deployed at low altitude as they would in a normal landing. Interestingly, the landing leg deployment seems to have slowed down the rocket's rotation just before impact in the ocean.

While the landing was unsuccessful, the primary goal of Wednesday's mission was to deliver the Dragon cargo ship to the proper orbit. And the Falcon 9 did just that.

If all goes well, the spacecraft will reach the station Saturday morning, pulling up to within about 30 feet and then standing by while station commander Alexander Gerst, operating the lab's robot arm, locks onto a grapple fixture.

Flight controllers at the Johnson Space Center in Houston will take over at that point, operating the arm by remote control to pull the Dragon in for berthing at the Earth-facing port of the station's forward Harmony module.

Science gear, experiments and a spacewalk

The science gear on board includes an experiment to test robotic spacecraft refueling techniques using ultra-cold cryogenic propellants, another instrument that will use laser beams to measure tree heights globally to determine the effects of deforestation on carbon dioxide processing and another to develop wound dressings that improve drug delivery.

Yet another experiment will study development of retinal implants intended to restore vision to patients with age-related macular degeneration and retinitis pigmentosa. The Marvel Guardians of the Galaxy Space Station Challenge is sponsoring student experiments to develop a UV-activated dental glue that could help astronauts on long-duration voyages and another testing a mist-based irrigation system for plants grown in space.

With the Dragon in hand, the station crew will turn its attention to a planned spacewalk next Tuesday by cosmonauts Sergey Prokopyev and Oleg Kononenko to inspect the Soyuz MS-09/55S ferry ship that carried Gerst, Prokopyev and Serena Auñón-Chancellor into orbit on June 6. Kononenko arrived at the station Monday along with Canadian astronaut David Saint-Jacques and NASA astronaut Anne McClain.

In late August, sensors detected a small pressure drop in the station's air supply that was traced to a leak in the upper habitation module of the Soyuz MS-09 vehicle. An inspection revealed what looked like a small hole drilled into an interior panel.

Prokopyev sealed the hole with cloth soaked in epoxy and stopped the leak. Russian engineers ordered the spacewalk next week to inspect the exterior of the Soyuz to look for any signs of damage that might be related to the hole found inside the spacecraft.

While the hole appeared to be the result of deliberate action on someone's part, presumably before launch, the Russians have not yet revealed any conclusions.

In any case, the habitation module is discarded before atmospheric entry and the issue is not considered any sort of safety threat when Gerst, Prokopyev and Auñón-Chancellor return to Earth on Dec. 20.