(CNN) -- Flying penguins are unusual. Especially when they fly on a C-130 Hercules military plane.
Almost 400 lost Magellanic penguins march back to the sea after being rescued by animal-welfare groups.
In Brazil, 373 young Magellanic penguins were rescued, rehabilitated and released last weekend after their search for food left them stranded, hundreds of miles from their usual feeding grounds.
Animal-welfare activists loaded the birds onto a Brazilian air force cargo plane and flew them 1,550 miles to the country's southern coast, where a crowd of onlookers celebrated as the penguins marched back into the sea.
"We are overjoyed to see these penguins waddle back to the ocean and have a second chance at life," said veterinarian Dr. Valeria Ruoppolo of the International Fund for Animal Welfare, the group that oversaw the rescue. See photo gallery of rescued penguins »
Magellanic penguins are warm-weather birds that breed in large colonies in southern Argentina and Chile. The young animals then migrate north between March and September, following their favorite fish, the anchovy. The birds are named after Portuguese explorer Ferdinand Magellan, who first saw them in 1519.
But changes in currents and water temperature apparently confused the juvenile birds, who strayed too far north to the warm beaches of Salvador, Brazil, 870 miles north of Sao Paulo, Brazil. Watch the penguins march into the sea »
Starting in mid-July, in the northeastern Brazilian state of Bahía, "It was just about raining penguins," Ruoppolo said. "There was not much of a food supply. The birds were stranded and emaciated. They had lost all their muscles and body condition."
While occasionally a few birds show up so far north, the unusual sight of hundreds of wayward penguins posed a challenge for animal conservation groups.
"We had to learn how to work with them," said Carlos Garcia, a spokesman for IBAMA, the Brazilian Institute for Environment and Renewable Resources. "Fewer than 20 penguins usually wash ashore, but with such a large number, we had to really understand their biology and learn how to treat them."
The Instituto Mamíferos Aquáticos (Institute for Aquatic Mammals) also fed and cared for the hungry and disoriented birds.
Ruoppolo, who is also the emergency relief officer for IFAW, has a lot of experience saving penguins and other animals injured in oil spills. Last week she worked with conservation groups and volunteers to save as many of the birds as possible.
"We showed them how to stabilize the animals, to feed them and give them proper care," she said. Healthy Magellanic penguins grow to about 27 inches tall and weigh about 9 pounds.
Ruoppolo said IBAMA -- the government's environmental authority -- and the Brazilian military were supportive throughout the unusual relocation mission.
On Friday, the penguins were loaded into special crates and put onto the plane for the journey to Pelotas, in southern Brazil. After their first-ever flight, the birds went on a truck ride to the Center for Recovery of Marine Animals, where they rested for 24 hours.
The birds released at Cassino Beach the next day had to meet very specific health criteria, said Ruoppolo.
"Their feathers had to be waterproof, their overall body condition had to be good, their lungs healthy, and they had to be able to catch food," she said.
The youngsters had some adult supervision for their return to the wild. They were released with a small group of adult penguins that had been nursed back to health after surviving an oil spill. Scientists expect the older birds will help guide the little ones to nearby feeding grounds.
Some penguins are still being cared for, both in the north and south of Brazil. The newly released birds have bands on their flippers so scientists can follow their progress and learn more about their migratory habits.
Of more than 1,600 penguins that washed ashore in northern Brazil, about half are still alive. That is a fairly good outcome, given the fragile status of young birds on their first migration, said Ruoppolo.
"For all species you have animals that die within the first year," she said.
And without quick human intervention, the consequences would have been much worse. At this point there is no way to know exactly why the animals became stranded.
While the Magellanic penguin population is not in jeopardy because of this one event, Ruoppolo said there are other threats, primarily from overfishing.
CNN's Paulo Nogueira contributed to this report
All About International Fund for Animal Welfare • Brazil