• Taliban spokesman says 'they did the right thing' • Renewed controversy over peace deal in Swat valley

The Pakistani government has ordered an inquiry into the flogging of a 17-year-old woman by Taliban militants in the troubled Swat valley, after public outrage triggered by shocking video footage of the punishment.

The images, played yesterday on private television channels, show a burka-clad woman being pinned to the ground by two men while a third whips her backside 34 times. The woman is seen screaming and begging for mercy as a crowd of largely silent men look on. She is accused of having had an illegal sexual relationship, according to local law. Her brother is among those restraining her.

President Asif Ali Zardari led a wave of public condemnation, and ordered the arrest of the perpetrators. Prime minister Yousaf Raza Gilani termed it "shocking" and called for an immediate inquiry. At the supreme court, the newly reinstated chief justice, Iftikhar Chaudhry, summoned officials to a hearing scheduled for Monday to investigate the incident.

"Our constitution allows no space for such public brutality, and our civilisation and culture have no tolerance for it either," said Sherry Rehman, a former information minister.

But the talk of arrests and inquiries are unlikely to amount to much. The Pakistan government's writ has all but collapsed in Swat, where armed militants loyal to a hardline preacher named Maulana Fazlullah have taken control. The teenage woman was flogged in Kabbal, a remote district where Taliban rule is the law. An order by the chief justice to produce the woman in Islamabad next Monday is unlikely to be heeded.

Muslim Khan, a Taliban spokesman, defended the punishment as appropriate under Islamic law, but said it should have been applied by a pre-pubescent boy in a private setting. "She had to be punished," he told Geo News. "The punishment administered by local Taliban was in our knowledge and they did the right thing, but the method was wrong."

That assertion was challenged by Islamic scholars who appeared on television chat shows throughout the day, often in between clips of outraged comments from ordinary Pakistanis. Harsh punishments such as flogging and stoning are considered to have been imported from the Middle East, and at odds with the milder version of Islam that is indigenous to South Asia.

Public outrage reignited debate over the merits of a controversial peace deal signed last February, under which the government ceded control of the valley's judicial system to the militants in an effort to buy peace.

Once a picturesque valley favoured by honeymooning couples, Swat is now better known as a centre of violence and repression. An estimated 1,200 people have been killed and at least 250,000 have fled since hostilities erupted almost two years ago.

Women have been particularly hard hit. The Taliban have burned or bombed 200 girls' schools, shot dead female performing dancers and dumped their bodies in the street, and imposed harsh restrictions on women venturing into public.

The peace deal has brought a measure of peace to Swat, and a hybrid judicial system mixing Islamic and traditional law has become operational. But Zardari has refused to sign a bill finalising Islamic law, saying he will only do so when peace becomes permanent.

Controversy also erupted over the timing of the video. Local reporters and human rights activists told the Guardian that the flogging had taken place within the past three weeks. But the provincial government and the Taliban insisted that it occurred long before the Swat peace deal was signed on February 16.

In different interviews Khan variously estimated the timing at between two, nine and 12 months ago. Mian Iftikhar Hussain, the provincial information minister, said the flogging took place on January 3, and accused those airing the tape of wanting to scupper the peace process.

Debate mostly focused on how to deal with the burgeoning Taliban menace, however. Some worry that the "Talibanisation" of the frontier could eventually spread into the rest of Pakistan.

The Obama administration has criticised Pakistan for striking peace deals with militants, worrying that they provide safe havens for extremists launching cross-border attacks against US and Nato troops in Afghanistan.