BEIJING (Reuters) - China’s parliament abolished on Saturday an extra-judicial system of forced labor used to punish sex workers and their clients for up to two years, but it stressed that prostitution remains illegal.

China banned prostitution after the Communist revolution in 1949, but it returned with a vengeance after landmark economic reforms began in the late 1970s, despite periodic crackdowns.

The official Xinhua news agency said China’s largely rubber-stamp legislature had voted to scrap the “custody and education” system. It said the decision would be effective from Sunday, when all those currently held in detention under the system would be released.

State media said the instruction to do away with the system had come from the Cabinet and parliament had recommended a review last year, noting that the program was increasingly not being applied in practice.

It had come in for criticism not only for its extra-judicial nature, as China seeks to promote a more law-based society, but also because of abuses such as the supposed rehabilitation facilities being run as profit-making ventures.

Xinhua said that when the system was instigated two decades ago it had “played an important role in educating and rescuing those involved in prostitution and visiting prostitutes”.

But as the country continues to deepen legal reforms and the criminal system, the “custody and education” program was less and less appropriate, it added.

“The custody and education system’s historical role had already been completed. This is an important manifestation of strengthening social management using rule of law thinking and methods,” the news agency said.

Prostitution remains illegal, however, with punishments of up to 15 days in detention and fines of up to 5,000 yuan ($714.76), Xinhua said.

In 2013, China scrapped another controversial forced labor statute - the re-education through labor system.

That decision followed several high-profile miscarriages of justice, including a case where a woman was sent to a labor camp after demanding justice for her daughter who had been raped.

The re-education through labor system, which began in 1957, had empowered police to sentence petty criminals to up to four years in detention without going through the courts.

($1 = 6.9954 Chinese yuan renminbi)