SYDNEY, Australia — For the first time in nearly four years, a group of migrants was caught illegally entering the Australian mainland by sea this week, after surviving a shipwreck and several days in crocodile-infested waters, the authorities said.

By Tuesday, all 17 migrants believed to be aboard the boat were found near the mangrove swamps of Far North Queensland, two days after the vessel ran aground and law enforcement officials began a search.

Once the migrants were all accounted for, the government said on Tuesday that the group would be sent to Christmas Island, an Australian territory nearly 1,000 miles from the closest point in continental Australia, where they would be detained and their immigration statuses determined.

“Under Australia’s strict border protection policies, no one who travels to Australia illegally by boat is permitted to remain in Australia,” the Department of Home Affairs said in a statement released on Tuesday. “These individuals are being processed on Christmas Island.”