Sahar Gul, then a 15-year-old Afghan wife, being carried to hospital in Baghlan. Her in-laws tortured her to force her into prostitution. Photograph: Jawed Basharat/AP

Human rights activists have warned of an new assault on women's rights in Afghanistan after judges and prosecutors allowed the early release of three people convicted for the brutal torture of a child bride, and conservative lawmakers made an aggressive bid to prevent relatives testifying against each other.

If successful, the small change – introduced covertly into the criminal prosecution code – would stop the vast majority of cases of violence against women from ever reaching court.

Together with the quashing of three convictions for the attempted murder of the teenager Sahar Gul, it marks an alarming two-pronged assault on women's rights by both those who make the laws and those tasked with upholding them.

"The last two months have really been a parade of horrible for women's rights in Afghanistan," said Heather Barr, Afghanistan researcher at Human Rights Watch, warning that the proposed change to the criminal code would leave most abused women with no legal protection against violence.

"Underage marriage, forced marriage, domestic violence, sale of women – these crimes are almost always committed against women by family members, whether through birth or through marriage."

The 10-year sentences handed down to Gul's tormentors last year was hailed as an important step forward, after her case horrified Afghanistan and prompted a bout of national soul-searching.

She was sold as a wife when she was an illiterate 12-year-old and her in-laws wasted little time embarking on a campaign of almost unimaginable torture. They starved her, chained her in a basement bathroom, beat her, burned her with red-hot metal pipes and pulled her fingernails out.

By the end of her ordeal she could no longer walk, and was rescued from her makeshift prison in a wheelbarrow. But last week, according to her lawyer and women's activists, a court ordered the release of Gul's mother-in-law, father-in-law, and sister-in-law saying there was no proof of abuse.

No evidence

"This was based on the idea that there was no evidence, but the people who would have given evidence didn't know that the hearing was taking place," said Kimberley Motley, a Kabul-based US lawyer who took on Gul's case last week after learning of the release.

Judges ignored the fact that the courtroom was almost empty, with apparently no representation from government prosecutors or the victim, even though both should have been informed under Afghan law.

Sahar Gul at a women's shelter in Kabul, Afghanistan, last year. She was not told about the release of her three in-laws, her lawyer said. Photograph: Kuni Takahashi/New York Times/Redux/eyevine

"Sahar Gul was not told about this," Motley said. "The prosecutor didn't show up or wasn't informed. I believe the only person in court was the defence lawyer for the accused."

The quashing of the conviction was followed by a suspiciously rapid release of the prisoners, just two days later. In Afghanistan there are many layers of baffling paperwork between an overturned conviction and freedom, that usually take at least a month to complete.

"I cannot see that [process] happening in a legal way in two days' time in Afghanistan," said Motley. "It has taken me a minimum of seven working days to secure the release of clients, and that's when I'm devoting 100% of my time to it. But I don't pay [bribes]."

Judges must firstly put their decision in writing. That letter is taken to the prosecutors, who can mull an appeal for up to 30 days before authorising a release. If they accept the judgment, their signature travels by the rickety postal system to the central prison directorate, which attaches another letter to the pile of documents and sends it to the prison where the prisoner is housed, Motley said.

The prison governor must also sign off, and take the prisoners back to the office of the attorney general, who finally signs off again on the release and the prisoner is finally released.

The process means that even if government prosecutors were not told of the original hearing, they must have twice had the chance to appeal or prevent the release, but passed it up.

Systematic failure

"This is a systematic failure. This is corruption at the core of the justice system. I don't know how they can justify how this happened to this girl," said Motley, adding that the release would have involved the connivance of three judges and a prosecutor "at an absolute minimum".

The attorney general's office could not be reached for comment on the case.

Sahar Gul only heard about the release when an organisation now supporting her recovery and education tried to chase up whether a date had been set to hear an appeal by her in-laws.

"The lawyer went to court to find out when the trial was, and found out they had been released," said Manizha Naderi, executive director of Women for Afghan Women, which is supporting Gul. "We don't know where they are now … Sahar Gul is very scared, and wants them in jail for the rest of her life."

However terrifying women's advocates find the quashing of sentences for Sahar Gul's tormentors, the legal changes that some MPs are hoping to bring to the country's criminal prosecution code, now travelling through parliament, would have stopped the case even reaching court.

They have added a provision to clause 1 of article 26, which lists people who cannot be questioned as witnesses. "Relatives of the accused" are now grouped with small children, the accused's defence lawyer and others, according to one source who has seen a draft of the law.

Qazi Nazir Ahmad Hanafi, a conservative MP who has been a driving force in efforts to quash a landmark law on violence against women, confirmed to the Guardian that the provision had been added to a draft of the code that recently went through the lower house of parliament. It would still need to be passed by the upper house and signed by the president to become law.

Women's rights activists and female MPs who are outspoken about women's rights said they were not aware of the change, which still has to be approved by the upper house, but the head of the UN's human rights unit warned it could make prosecution of violence against women "almost impossible".

"The state [government] is obliged to protect women from domestic violence wherever it happens and prosecute whoever is committing such crimes including victims' family members," Georgette Gagnon told the Guardian.

It comes weeks after MPs quashed efforts to endorse a law on ending violence against women, arguing its terms against underage and forced marriage were unIslamic. The MPs also made a secret last-minute change to an election law, eliminating quotas of seats reserved for women on provincial councils.