(CNN) -- U.S. Marines boarded and seized control Thursday of a German-owned vessel that pirates had captured the day before off the coast of Somalia, the U.S. Fifth Fleet said.

It's the first time U.S. military forces off Somalia have staged an action to board a commercial vessel in which pirates were on board with hostages, said a U.S. Navy spokesman, who was not authorized to speak publicly but had direct knowledge of the incident.

The action came about because the highly specialized Marine raiding force -- the 15th Marine Expeditionary Unit's Maritime Raid Force -- was nearby, the spokesman said.

Twenty-four U.S. Marines from the force, which was aboard the USS Dubuque and operating under the multinational anti-piracy combined task force, boarded the M/V Magellan Star at about 5 a.m. local time, the Fifth Fleet said.

"This successful mission by combined maritime forces secured the safety of the ship's crew and returned control of the ship to the civilian mariners," a Fifth Fleet statement said.

No shots were fired, the Navy spokesman said, and there were no injuries. The pirates surrendered "within minutes."

U.S. Defense Secretary Robert Gates approved the mission, the spokesman said, and the military had permission from the ship's owners to board it.

Members of the ship's crew had locked themselves in a safe room, so the military felt it was a good time to board the ship, the spokesman said.

Nine pirates were in task force custody "pending further disposition," the Fifth Fleet said.

A Turkish frigate and combined task force flagship were the first on the scene, responding to a distress call Wednesday from the Magellan Star. Two additional warships assigned to the task force, the USS Dubuque and USS Princeton, later arrived to provide support.

Upon arrival, the Turkish frigate found a skiff with no one aboard, the Fifth Fleet said. The ship was carrying 11 crew members.

"This regional problem truly has global impact, and we are completely committed to bringing the disruptive acts of piracy to an end," said Turkish Navy Rear Adm. Sinan Ertugrul, commander of the anti-piracy Combined Task Force 151. "We have full support of the international community and will continue to do everything possible to bring security [to] the Gulf of Aden and Somali Basin."

Combined Task Force 151 is one of three task forces operated by the 25-nation Combined Maritime Forces. The task force was established in January 2009 to combat piracy after a dramatic increase in attacks in the region.

CNN's Barbara Starr contributed to this report.