Police will cease to automatically pass information about people suspected of being in the country illegally to deportation authorities if they come forward as victims of crime, according to a new policy hammered out in the wake of the Windrush scandal, the Guardian has learned.

The new measures, agreed by police chiefs in England and Wales, include a ban on officers checking the police national computer solely to see if someone has leave to remain in the UK.

Police now say they were perceived as being too close to deportation authorities as the government pursued its hostile environment policy.

They believe it damaged their standing in communities they need to police – and may have deterred victims of modern slavery and trafficking from coming forward.

The new policy, entitled “information exchange regarding victims of crime with no leave to remain”, represents the return of a “wall” between the police and the deportation authorities, and has been agreed with immigration enforcement.

Devon and Cornwall’s chief constable, Shaun Sawyer, who leads for the National Police Chiefs Council on modern slavery and organised immigration crime, said: “There were some who perceived we were becoming part of that hostile environment.

“It was imperative that we were clear with our staff that the role of the police and immigration enforcement are different. We had an inappropriate relationship with immigration enforcement whereby, by proxy, we were helping to kick people out of the country.

“There were a handful of cases that showed the relationship was too close and could not be tolerated. We are not a branch of immigration enforcement; we deal with crime and vulnerability.”

Initiatives such as Operation Nexus – where police joined in efforts hunting foreign national offenders – involved them working closely with immigration authorities.

Sawyer said: “Operation Nexus has a place in terms of foreign national offenders, in keeping people safe, but it was blurring the line of frontline police who we require to see the situation and the victims first, not their status in the UK.”

The new policy, agreed by police chiefs, says: “In the circumstances where a person reporting a crime is also identified, potentially, as a person without leave to remain or to enter the UK, the fundamental principle must be for the police to first and foremost treat them as a victim.”

It also says: “A PNC [police national computer] check must not be carried out solely to establish if the victim has breached immigration legislation.”

It adds: “Where police are investigating a crime, and during that investigation, whether on the initial report or subsequently, it becomes apparent that the victim is also suspected of being an illegal immigrant, it is wholly appropriate that the officer in the case should contact immigration enforcement at the appropriate juncture, whilst ensuring they are also treated as a victim. The police will share that information with immigration enforcement, but will not take any enforcement action in relation to any suspected immigration breaches.”

The police say the policy before was haphazard, with officers in some forces contacting immigration officers and others not doing so.

The document sets out the risks of getting it wrong, saying: “The issue of a person reporting a crime who transpires to be in the UK without leave to remain is one of those more complex areas where our response needs to be more considered, as inappropriate action or inaction could lead to that individual being exposed to exploitation or vulnerability.”

It is believed that Liberty, the civil liberties group, was about to start action challenging police on their stance over sharing information with immigration enforcement.

A spokesperson for Liberty said: “Police forces should commit to, and rapidly implement, a firewall between their interactions with victims and witnesses of crime and the data they hold on them, and Home Office immigration enforcement. They should not refer victims or witnesses of crime to the Home Office for immigration enforcement purposes.”

Sawyer, a former senior counter-terrorism officer, said the standing of police especially in ethnic minority communities was being damaged.

“As the national lead I have received information from forces in the past that there have been community tensions following joint police and immigration enforcement operations,” he said.

The paper was drawn up by the National Police Chiefs Council, which represents police leaders across forces in England and Wales.

One senior source told the Guardian that there was a risk some crime victims may have been handed over to immigration authorities in the past.