ISLAMABAD (AP) — Pakistan Prime Minister Imran Khan on Wednesday ordered authorities to release from prison all female prisoners who suffer from physical or mental illness or who are age 55 or older.

Khan also announced that all juvenile prisoners around the country will be released.

A Pakistani court ordered the releases months ago and there was no appeal of that ruling. Khan on Wednesday announced his government would implement a plan for the releases.

About 1,200 women and girls who are on trial or have been convicted of a crime are imprisoned in Pakistan.

Human rights activists have long campaigned for the release of women prisoners and their children who are languishing in Pakistan’s jails and prisons. More than 1,000 children inmates under age 18 are also imprisoned in Pakistan.

Khan, in a series of tweets, also ordered a report on foreign women in Pakistani prisons, including ones on death row, for consideration for release on humanitarian grounds.