Oscar Hernández recalls how his uncle paid a double price when he was arrested for failing to pay road tolls: local police in Houston handed him to immigration officials who deported him to Mexico.

In the years since, Hernández, also an undocumented immigrant from Mexico, has campaigned to end a program that deputises local officials to act as federal immigration agents, potentially turning a minor infraction into a life-altering event.

The 28-year-old community organiser with United We Dream celebrated a victory this week, after the Harris County sheriff’s office announced it would end its use of this program, known as 287(g).

The announcement from the county’s new sheriff comes as Donald Trump has escalated the pressure on local police to work more closely with immigration officials. In an executive order signed in January, he cited 287(g) to say that he would “empower State and local law enforcement agencies across the country to perform the functions of an immigration officer”.

Hernández said that 287(g) “encourages racial profiling, it keeps a system where if law enforcement only see undocumented immigrants as people they put in jail then it makes it very difficult for the community to trust law enforcement … If you’re undocumented then you become a target.”

The most notorious deployment of 287(g) was in the Phoenix, Arizona, area under the reign of former Maricopa County sheriff Joe Arpaio. His office’s participation was terminated after accusations by the US justice department that Latinos were racially profiled.

But Ed Gonzalez, a Democrat elected last November, nonetheless announced he would end the program because of its cost.

He told the Houston Chronicle that 10 deputies trained to assess the immigration status of jailed suspects and hold them for deportation by Immigration and Customs Enforcement (Ice) will be reassigned to other duties.

Gonzalez characterised the move as not politically motivated, but during his election campaign, he pledged to end 287(g), calling it not only a strain on resources but “a violation of due process rights [that] leads to racial profiling, the separation of families and a mistrust of deputies”.

Participants access databases to check the immigration status of suspects who are arrested even for minor offences like traffic violations, quickly receiving and passing on information so it is less likely that someone will be released before federal agents can take them into custody.

According to Ice, the program identified more than 402,000 “potentially removable” non-US citizens between January 2006 and September 2015. Currently, though, only 37 departments in 16 states are participating, down from 77 in 2009; three are in Texas.

With more than 4 million residents, Harris was the most populous county in the programme. “We’re elated by the decision by the sheriff,” said Mary Moreno of the Texas Organizing Project, a group that pushes for social and economic equality. “It did have a chilling effect in the community. Even though everybody who supported it said it was an inside-the-jail programme, its effects were definitely felt outside the jail.

Still, other new jurisdictions are likely to join the program at Trump’s urging. Five agencies have signed up since his election in November, and others have said they are negotiating with Ice about setting up a 287(g) agreement. Five agencies have signed up since his victory last November.

As well as promoting increased deportations of undocumented immigrants who have committed crimes, or are merely suspects, Trump intends to withhold federal funds from so-called sanctuary cities who do not cooperate fully with Ice.

Republican politicians in Texas, including the governor, Greg Abbott, are attempting to pass a law that would withhold funding from sanctuary cities. He has already cut $1.5m in criminal justice grant money from Travis County, whose sheriff, Sally Hernandez, is no longer complying with Ice “detainer” requests to hold immigrants in custody for pick-up by federal agents, except for those suspected of serious crimes.

Gonzalez told the Chronicle that he will still honour Ice detainer requests. But activists are optimistic that his action will lead to fewer people being deported after arrests for minor crimes, and boost relations with police among those in the community who perceive local officers to be in cahoots with Ice and so are reluctant to interact, for example to report crimes.

Still, as well as promoting use of 287(g), Trump’s executive order on border security and immigration last month also lays a path for the return of the Secure Communities programme, which operated from 2008-2014 and saw jails routinely send fingerprints of arrestees to federal agencies. It was scrapped amid concerns that it led to constitutional violations, the erosion of community trust and deportations of immigrants who had not committed serious crimes.

If it is reintroduced, Ice may swiftly be able to identify and collect undocumented immigrants from jails regardless of whether there is a 287(g) agreement in place or not.

“It remains to be seen what difference that will make – between the federal government issuing the detainers and police themselves issuing the detainers,” said Michele Waslin, a senior research and policy analyst with the American Immigration Council. “There is no ‘sanctuary’ in that police agencies do cooperate with Ice in multiple ways.”

Ultimately, Waslin believes, “we need to get back to conversations about national immigration reform. The fact that there are 11 million unauthorised immigrants is a symptom that there’s something wrong with our immigration system and we cannot just enforce our way out of it through this patchwork of enforcement mechanisms.”