SYDNEY, Australia — The Australian Parliament on Wednesday repealed a law that had allowed refugees and asylum seekers being held offshore to seek emergency medical care in Australia, a reversal that human rights advocates denounced as cruel and shameful.

The vote, which came 10 months after the law was enacted, was the latest example of the Australian government’s hard-line stance on border protection, a policy it has maintained even as the United Nations has condemned it for detaining asylum seekers who were intercepted at sea indefinitely, on islands in the Pacific.

“This was always a law that was about getting people here through the back door, and today we’ve closed that back door,” Peter Dutton, the minister for home affairs, told reporters in Canberra, the capital. He added that it had undermined efforts to resettle refugees in the United States under a deal struck in 2016.

The independent senator who cast the decisive vote to repeal the measure, Jacqui Lambie, said it would return decision-making power to lawmakers from doctors, whose approval was required for a medical transfer.