Image caption The Free Syrian Police project is run from Gaziantep in Turkey, just across the border from Syria

The government has suspended a foreign aid project after a BBC Panorama investigation found taxpayers' cash was being diverted to extremists in Syria.

Officers from a UK-backed police force in Syria have also been working with courts carrying out brutal sentences.

A UK government spokesman said it takes allegations of co-operation with terrorist groups "extremely seriously".

Adam Smith International, the British company running the project, said it strongly denies the allegations.

The Free Syrian Police (FSP) was set up following the uprising in Syria, to bring law and order to parts of the country that were controlled by opposition forces.

Adam Smith International (ASI) has been running the project since October 2014.

Britain was one of six donor countries paying for the project, which provides community policing to the rebel-held areas of Aleppo, Idlib and Daraa provinces.

It is intended to be an unarmed civilian police force, and not co-operate with extremist groups, but Panorama has found examples where that was not the case. Some of Panorama's allegations against the project include:

Police cooperating with courts that carry out summary executions - including a case where two women were stoned to death

Police being paid in cash and then being forced to hand over funds to an extremist group controlling the area

Police officers being handpicked by an extremist group

Dead and fictitious people are on the police payroll

Foreign Secretary Boris Johnson announced in April that the UK would commit a further £4 million to the UK-funded Access to Justice and Community Security (AJACS) scheme that supports the FSP.

ASI says the FSP is an unarmed community police force that brings the rule of law and safety to millions of people in a war-torn country.

An ASI spokesman said it "strongly refutes Panorama's allegations".

"We have managed taxpayers' money effectively to confront terrorism, bring security to Syrian communities and mitigate the considerable risks of operating in a war zone," he said.

"ASI has managed the project successfully alongside our partner in an extremely challenging, high-risk environment under the close supervision of the Foreign and Commonwealth Office and five other governments."

The company says it uses cash to fund the police because there is no practical alternative - and that the British government is aware of the payments.

Image caption A police station in Koknaya was supposed to be the base for 57 officers - but ASI staff could not find any police officers during a visit in 2016

Panorama has obtained ASI documents that show dead and fictitious people were on the police payroll.

One police station in Koknaya in Idlib province was supposed to be the base for 57 police officers. But the documents show that when ASI's staff visited in September 2016, they couldn't find a single officer.

ASI said officers were accounted for on subsequent visits. The company has now suspended the payment of all salaries at the Koknaya police station.

It said it had identified very few examples across Syria where deceased officers had remained on the salary list.

The documents also show how some police officers in Aleppo province were forced to hand over cash to the extremist group - Nour al-Din al-Zinki - in control of the area.

The Nour al-Din al-Zinki Movement has been linked to atrocities including the beheading of a young prisoner in 2016.

An ASI report from July 2016 warned that 20% of all police salaries were being handed over "to pay for the military and security support that Zinki provides to the five FSP stations located areas under its control".

As well as handing over a cut of British aid money to Zinki, the police had also worked with a Zinki court "by writing up warrants, delivering notices, and turning criminals over to the court".

'Wholly abhorrent'

The police cooperation has continued despite allegations of torture and summary executions involving the court at al-Qasimiyeh.

Tory MP Crispin Blunt, former chair of the Foreign Affairs Committee, said the FSP should not be supporting extremist courts.

He said: "You've got people being sentenced to death for homosexuality.

"Clearly that is completely and utterly unacceptable by any standard and the idea that British taxpayers' money was associated with that would of course be wholly abhorrent."

ASI says it has strict guidelines in place to ensure detainees are treated fairly and humanely, and that payments to the police stations which were paying Zinki were stopped in August 2016. It says donor governments were kept fully informed.

Image caption A road near Sarmin - where two women were stoned to death in the presence of FSP officers

Panorama also discovered that the Free Syrian Police provided support for courts run by the Syrian branch of al-Qaeda - Jabhat al-Nusra - which handed out extreme punishments.

Police officers were present when two women were stoned to death near Sarmin in December 2014. Sources have told Panorama the officers closed the road so that the execution could take place.

ASI says the police officers who attended the stoning were not formally under FSP control and have since been removed.

Panorama has also seen evidence that al-Nusra handpicked police officers in two stations in Idlib province.

ASI says that the officers imposed by al-Nusra were detected in under two months and that payments to the station were then stopped.

The company says the payments in question only amounted to $1,800 (£1,340) and did not come from British government funds. But ASI didn't explain how they could be sure when the whole project is funded by cash.

A UK government spokesman said: "We take any allegations of co-operation with terrorist groups and of human rights abuses extremely seriously and the Foreign Office has suspended this programme while we investigate these allegations.

"We believe that such work in Syria is important to protect our national security interest but of course we reach this judgment carefully given that in such a challenging environment no activity is without risk.

"That's why all our programmes are designed carefully and subject to robust monitoring."

You can see more on this story on Panorama, Jihadis You Pay For on BBC One at 7.30pm on Monday 4 December and afterwards on iPlayer.