(CNN) -- All 64 students and crew on a Canadian ship that sank 300 miles from the Brazilian coast have been rescued, a Canadian air force officer said Friday afternoon.

The Canadians were aboard the West Island College Class Afloat school ship Concordia as part of a 10-month accredited high school and university program. The ship was traveling between Recife, Brazil, and Montevideo, Uruguay.

"It's a tragedy to lose a ship, but a victory that they were rescued," said Maj. Denis McGuire of the Canadian Joint Rescue and Coordination Center.

The students and crew had been aboard three lifeboats in the Atlantic Ocean and were picked up by two nearby merchant vessels, McGuire said. The Canadians will be transferred to a Brazilian navy ship and taken to shore, McGuire said.

Brazilian media reported that the transfer will be done by helicopter.

The Concordia started sending out a distress signal Thursday, West Island College said on its Web site. It was not immediately known when or why it sank.

The ship left Recife on February 8 and was scheduled to dock in Montevideo next week, the Brazilian navy said in a news release.