SYDNEY, Australia — The Parliament of Papua New Guinea has voted to repeal the country’s Sorcery Act and to reinstate the death penalty in certain cases to help stem an increase in violence against people accused of practicing black magic.

Such violence is endemic in the South Pacific island nation, and a rise in the number of public killings in the past year has prompted international condemnation and embarrassed the government of Prime Minister Peter O’Neill.

Last month, he vowed to repeal the 1971 Sorcery Act, which criminalized the practice of sorcery and recognized the accusation of sorcery as a defense in murder cases. He made the pledge after the highly publicized decapitation of an elderly former teacher by a mob whose members accused her of using witchcraft to kill a colleague.

Under the amendments passed on Tuesday, rape, robbery and murder will be among the crimes that can now draw a death sentence. Although death by hanging has been legal for decades in Papua New Guinea, a former Australian colony, no hangings have been carried out since 1954. A variety of new methods of execution — lethal injection, asphyxiation, firing squad and electrocution — were stipulated as part of the new legislation.