Poland became the first EU country held to account for its involvement in the CIA's extraordinary rendition programme on Thursday when the European court of human rights found it guilty of the unlawful detention and torture of two men at a secret prison in the north of the country after 9/11.

In two damning judgments, the court also ruled that the Polish government had failed to conduct a proper investigation into the episode, and ordered it to pay €100,000 (£79,000) compensation to each of the men, who are currently held at Guantánamo Bay. The rulings are the first in a series of cases being brought against European states, with Lithuania and Romania also facing accusations that they allowed the CIA to open secret prisons on their territory.

The case against Poland was brought by two men, Zayn al-Abidin Muhammad Husayn, a Saudi-born Palestinian known as Abu Zubaydah, and Saudi national Abd al-Rahim al-Nashiri.

Abu Zubaydah was initially detained in Pakistan in 2002 and accused of being a senior al-Qaida figure, although there has since been some doubt over the role he may have played. He was flown to Poland from a CIA prison in Thailand in December 2002, remaining there until September the following year.

Nashiri is accused of masterminding the October 2000 suicide bomb attack against the USS Cole, in which 17 people died, and is facing prosecution before a military commission. He was flown to Poland on the same executive jet as Abu Zubaydah, and transferred to Morocco the following June.

The court heard that the two men were held at a prison codenamed Quartz that the CIA operated at the Stare Kiejkuty military base in the north-east of the country.

The judgment in the Abu Zubaydah case recounted how he had described being repeatedly beaten, confined in a small box, and brought out to be repeatedly waterboarded.

"I was … put on what looked like a hospital bed, and strapped down very tightly with belts. A black cloth was then placed over my face and the interrogators used a mineral water bottle to pour water on the cloth so that I could not breathe. After a few minutes the cloth was removed and the bed was rotated into an upright position.

"The bed was then again lowered to horizontal position and the same torture carried out again with the black cloth over my face and water poured on from a bottle. I struggled against the straps, trying to breathe, but it was hopeless. I thought I was going to die."

The court said that Abu Zubaydah's continuing detention without trial was "a flagrant denial of justice". In addition to the compensation, given because of what was described as the "extreme seriousness of the violations" of the European convention of human rights, Abu Zubaydah was awarded €30,000 costs.

The judgment in the Nashiri case described how he had been kept naked, subjected to mock executions, hoisted by his wrists while his arms were shackled behind his back, and told that his mother would be sexually abused before him.

The two unanimous rulings found that the rendition programme was completely illegal, as its rationale had been "specifically to remove those persons from any legal protection against torture and enforced disappearance and to strip them of any safeguards afforded by both the US constitution and international law".

The court at Strasbourg said it was inconceivable that the rendition aircraft could have landed in Poland, and that the CIA could have operated the prison on Polish territory, without the Polish authorities being aware. "It is also inconceivable that activities of that character and scale, possibly vital for the country's military and political interests, could have been undertaken on Polish territory without Poland's knowledge and without the necessary authorisation being given at the appropriate level of the state authorities."

It also ruled that the Polish government must seek assurances from the US that Nashiri will not face the death penalty.

The Guardian reported more than seven years ago on the existence of the secret CIA prison on Polish soil, quoting the former director of a nearby airport who witnessed the rendition aircraft being met by military vehicles with blacked-out windows.

"On one occasion an American lady – I was told she was from the embassy – came with the man who made the payments. She was standing in front of the airport office when the military vehicles left. She turned her back on the vehicles. It seemed as if she did not want to be a witness."

Since then, the Polish authorities have said that they have been conducting their own investigation, but have faced accusations that it has been drawn-out and ineffective. The European court ruled that the Polish response failed to provide an effective remedy, and that it too amounted to a breach of the European convention on human rights.

Amrit Singh, a lawyer at the Open Society Justice Initiative who represented Nashiri, said: "This is a historic ruling by the European court of human rights, which has become the first court to confirm the existence of a secret CIA torture centre on Polish soil between 2002 and 2003, where our client was held and tortured.

"The court's findings include a damning indictment of the US military commission system, where our client is now facing trial for his life, and also a condemnation of the death penalty itself."

Joseph Margulies, one of Abu Zubaydah's American lawyers, said: "It's always gratifying when a court speaks truth to power. The question now is whether Poland will listen. The rule of law demands more than words on a page. It demands justice."

A Polish presidential spokeswoman, Joanna Trzaska-Wieczorek, said: "The ruling of the tribunal in Strasbourg on CIA jails is embarrassing for Poland and is a burden both in terms of our country's finances as well as its image."

She added that it was possible the government would appeal.