(CNN) -- A French hostage and two pirates died Friday in a rescue operation off Somalia, the French president's office in Paris said Friday.
Four hostages, including a child, were freed from the hijacked yacht after almost a week of captivity.
Four hostages, including a child, were freed from the hijacked yacht after almost a week of captivity, Nicolas Sarkozy's office said.
The four adults and a child had been held aboard their yacht, the Tanit, since it was seized in the Gulf of Aden on Saturday, the president's statement said.
The military made its move after the pirates refused their offers, including one to swap an officer for the mother and child held aboard, and threatened to execute the hostages one-by-one -- and because the Tanit was drifting closer to the Somalian coast, the defense ministry said.
The possibility that the pirates could take their hostages ashore was a red line that prompted the mission. The same red line triggered two successful rescue missions by the French military last year, the ministry said.
According to French media reports, a special forces unit attacked the hijacked vessel from different directions in two motor-powered rubber boats. The pirates opened fire and the special forces team fired back.
Two of the five pirates were killed, along with Florent Lemacon, the owner of the Tanit, French media said. The military rescued Lemacon's wife and 3-year-old child along with two friends of the Lemacons.
The Lemacons and their friends left Brittany last summer in the Tanit on a round-the-world trip, according to a blog they were keeping about the trip. The blog's last post on March 20 -- when the Tanit was in the Gulf of Aden -- said the French military had twice contacted them in the previous few days to warn them of pirates.
The French military brought back 12 pirates to stand trial in the previous two rescue missions, the Defense Ministry said.
There has been a series of high-profile and increasingly sophisticated pirate attacks in recent months. View a map of Somali pirate activity »
Also off Somalia this week, the cargo vessel Maersk Alabama was boarded by pirates, who briefly took control of the ship.
Although the crew retook the ship, its captain, Richard Phillips, on Friday was still being held by the gang holed up in a lifeboat.
The Maersk was hijacked about 350 miles off Somalia's coast, a distance that used to be considered safe for ships navigating in the pirate-infested waters.
International navies have increased patrols in the area but the region is so large the pirates can still operate.
The U.S. military warned earlier this week that recent attacks have occurred hundreds of miles off the coast, suggesting that pirates are using "mother ships" -- a practice of using bigger boats with longer range to launch smaller pirate ships against targets further out to sea.
Last year, Somali pirates seized another French luxury yacht and the French military launched an operation that ended with them chasing the gang across the desert.