(CNN) As district attorney of San Francisco, Kamala Harris supported a city policy that required law enforcement to turn over undocumented juvenile immigrants to federal immigration authorities if they were arrested and suspected of committing a felony, regardless of whether they were actually convicted of a crime.

Harris, who was San Francisco's district attorney from 2004 to 2011, sided with then-Mayor Gavin Newsom in a political fight over San Francisco's status as a sanctuary city that split the city's municipal government, with the mayor's office supporting the policy and the city's elected Board of Supervisors opposing it.

Harris' past position could open her up to attacks from immigration activists as well as the more progressive wing of the party as she seeks the Democratic nomination in 2020. The fight over the San Francisco policy was covered extensively at the time, but Harris' role has not been closely examined since she entered the national spotlight. KFile explored her position during a review of her record on immigration.

In a statement to CNN, Harris campaign spokesman Ian Sams said that the "policy was intended to protect the sanctuary status of San Francisco and to ensure local police, who needed to have strong relationships with the communities they serve regardless of immigration status, were not forced to operate as immigration agents, which is the responsibility of the federal government. Looking back, this policy could have been applied more fairly."

Since winning election to the US Senate in 2016, Harris has established herself as an advocate for undocumented immigrants by pushing hard for a deal to protect from deportation those who came to the country as children, a group known as Dreamers. She has also called for the role of US Immigration and Customs Enforcement to be re-examined.

Still, her past position could prove a vulnerability in an increasingly crowded Democratic primary where candidates have been highly critical of President Donald Trump's policies on immigration and abolishing ICE has become a popular position among the party's base.

At issue in 2008 was Newsom's policy of reporting juvenile undocumented immigrants arrested by local police to ICE. As district attorney for San Francisco, Harris was responsible prosecuting crimes in the city.

San Francisco has been a sanctuary city since 1989, meaning that police were not obligated to give any information to federal immigration authorities about interactions with undocumented residents of the city. The city's policy was amended in 1992 to remove protections for criminal adult suspects, but the protection remained for arrested juveniles.

This policy came under scrutiny in 2008 when a 21-year-old undocumented man named Edwin Ramos was arrested for murdering three members of a San Francisco family.

After the news of the Ramos murders -- and his previous arrest records -- was reported by the San Francisco Chronicle, Newsom announced a change in the city's policy so that police would begin reporting arrested undocumented juveniles to ICE, regardless of whether they had been found guilty in court of any crime. Ramos had previously been arrested as a youth at 17 and was found guilty of attempted robbery and assault, but he was never reported to federal immigration authorities.

Up to this point in her tenure, Harris had established a record as a supporter of immigrant rights while district attorney: She supported issuing specialized visas for undocumented victims of violent crimes, prosecuted an unlicensed contractor in a labor exploitation case for wage theft of immigrants, and denounced proposed federal legislation that would have criminalized assisting undocumented immigrants. Her office put out a statement that "We are a sanctuary city, a city of refuge, and we always will be."

Still, Harris supported Newsom's policy change and issued a statement that the original sanctuary law "was never intended to shield anyone from being held accountable for a crime. It's intended to encourage immigrant victims and witnesses to report crimes without fear of reprisal so we can hold offenders accountable."

"While detained juveniles are under the custody and control of the juvenile probation office and the court every city agency needs to work together to balance our obligations under federal law and the sanctuary ordinance to solve crimes and put the offenders behind bars."

By 2009, the new policy had been in place for a year. The New York Times said over 100 juvenile suspects were reported to federal custody for deportation.

Multiple juveniles faced deportation over relatively minor crimes: in one instance reported by the Times, a 14-year-old who had been in the United States since he was 2 was handed over to ICE after he took a BB gun to school to show off to friends. In another instance, a 13-year-old and his family faced deportation after he punched another boy at school and stole 46 cents.

The city Board of Supervisors passed legislation making it so that youths could only be reported to federal immigration authorities if convicted of a felony. After Newsom vetoed the legislation, the Board had enough votes to override his veto, and passed the law without his signature. Despite this, Newsom refused to follow the legislation and ordered the city to continue reporting undocumented juvenile suspects to ICE.

During the fight between Newsom and the Board of Supervisors, Harris publicly supported Newsom and opposed the Board's legislation. She argued her position by saying that she believed the ordinance would be in violation of federal law and would be struck down in courts. San Francisco City Attorney's office told CNN this month that the ordinance has never been challenged in court.

In a speech at Stanford University in 2009 Harris explained her position, saying, "There was then an initiative that was written by the board of supervisors that was passed and there was opposition to that but it did pass," Harris said. "And so we're gonna have to wait to see how the courts interpret what it means. From my perspective, I think that it would be in conflict with federal law, and we have to follow the law. We have to follow that law. You may not agree with it, but you know, that's why we have a process where you can challenge laws. And it is the law."

The lead figure opposing Newsom and Harris was David Campos, a former member of the Board of Supervisors who introduced and passed the legislation to protect undocumented juveniles form deportation.

In a recent interview with CNN, Campos discussed the political fight and his disappointment with Harris position, and said that the two are friends who supported each other early in their political careers, but they disagreed over the issue.

"I tried to reach out to her on that issue and I never really got a response from her," Campos said.

"And actually when she left the district attorney's office, one thing that did happen was there was more openness to discussing the issue with the new D.A., when George Gascón became the district attorney after Kamala left. It was after Mayor Newsom and after Kamala Harris left that that issue potentially got resolved."

After Newsom left office in 2011 , his successor changed the city's policy again so that law enforcement would only report undocumented juvenile immigrants who were arrested to ICE if they couldn't prove family ties to the Bay Area, leading to a sharp drop in reporting. In 2013 , San Francisco passed another ordinance which prohibited reporting any arrested person to ICE except in limited circumstances.

Newsom was attacked from both the left and right for his position during his successful run for governor of California in 2018. He ultimately admitted that the policy could have been handled differently.

"These were people charged ... but not convicted. Some people ultimately were exonerated that got caught up in it," he told The Sacramento Bee last year. "I'll just say this to my critics: fair game. Looking back, there were things we could have done differently. I'm very honest about that."

Sams, spokesman for the Harris campaign, invoked Newsom's response in a statement to CNN, saying, "As Governor Newsom said last year, his policy was intended to protect the sanctuary status of San Francisco and to ensure local police, who needed to have strong relationships with the communities they serve regardless of immigration status, were not forced to operate as immigration agents, which is the responsibility of the federal government. Looking back, this policy could have been applied more fairly, as the governor has stated as well."

The spokesperson continued, "Senator Harris has always been a supporter of San Francisco's commitment to protecting undocumented people and keeping communities safe, which is why as D.A. she cracked down on trafficking that preys on undocumented immigrants, prosecuted individuals scamming or exploiting undocumented immigrants, and pushed for temporary protection visas for victims of crime."

Correction: This story has been updated to correct the spelling of George Gascón's name.