US transportation secretary Ray LaHood with Barack Obama. His son was among several Americans convicted in Egypt in absentia. Photograph: Pool/Getty Images

A Cairo criminal court has convicted 43 NGO workers, including at least 16 Americans, of operating without a licence and receiving foreign funding. The case had sparked international outrage, souring relations between Egypt and the US, and inflaming domestic fears over the potential for foreign funding to influence internal political affairs.

Twenty-seven of the defendants, all of whom were tried in absentia, received prison sentences of five years. Eleven of those who attended the trial received one-year suspended sentences, and five others received two years. Judge Makram Awad also ruled that the NGOs that the defendants worked for should be closed in Egypt.

Most of the Americans – including Sam LaHood, son of the US transportation secretary Ray LaHood – had already left the country. LaHood received a five-year jail term.

The case dates back to December 2011 when police conducted armed raids on 17 NGO offices across Cairo, detaining employees and seizing equipment. Forty-three workers, drawn from organisations including the US-government-funded National Democratic Institute (NDI) and Freedom House, were eventually put on trial for operating illegally in Egypt.

According to Egyptian law, NGOs have to be formally registered with the government. However, critics argue that the relevant legislation is ambiguous. Under article 5 of the current law regulating civil society, organisations which do not receive a response to their registration within 60 days are deemed to be legal.

As the judge delivered his verdict, shocked cries were heard in the courtroom. Speaking on Tuesday, defendants told the Guardian they were confident there was no legal basis to the prosecution's case.

The NGOs said the government was kept abreast of their activities throughout their time in Egypt. NDI was even given formal permission to conduct monitoring for the country's first democratic elections, following the fall of Hosni Mubarak.

Speaking outside the courtroom, the defence lawyer Dr Rafat Osman said the verdict had been rushed and failed to follow due process. "They didn't follow the correct procedures or considerations under Egyptian law," he said. The defendants will be appealing against their sentences, he confirmed.

There was no immediate comment from Washington on Tuesday's ruling, but it is likely to be met with dismay from the Obama administration.

Egypt and the US have been allies for more than three decades, with the Egyptian military receiving more than $1bn (£650m) in aid annually. The aid is linked to Egypt's adherence to an American-mediated 1979 peace treaty with Israel. Besides $1.3bn in US military aid, Egypt also receives about $250m in economic aid every year.

The work and funding of NGOs have consistently been a bone of contention with the authorities that try to control them. Last week, the New-York-based Human Rights Watch and 40 Egyptian rights groups said an Egyptian draft law would restrict the funding and operation of independent groups.

The contentious bill, proposed by the Islamist president, Mohamed Morsi, and currently under debate by the country's interim legislature, would allow the state to control NGOs' activities as well as their domestic and international funding, HRW said. The current form of the bill is a serious regression from earlier versions, it added.

In a joint statement, the 40 Egyptian rights groups accused Morsi's Muslim Brotherhood and its political arm of seeking to curb the freedom of rights groups through legal restrictions.