Sen. Kamala Harris, D-Calif., said she supports the decriminalization of sex work, as long as it's between consenting adults.

"I think so. I do," the 2020 presidential candidate said about whether it should be decriminalized in an interview with The Root published Tuesday.

But there should be limits to potential decriminalization, the former attorney general of California said. Those involved in sex work who harm others or profit from exploiting another person should not be "free of criminal prosecution," she said.

"But when you're talking about consenting adults, I think that yes, we should really consider that we can't criminalize consensual behavior, as long as no one is being harmed. But at the point that anyone is being harmed or exploited, then we have to understand that's a different matter," she explained.

Harris has been criticized for her support of the Stop Enabling Sex Traffickers Act and the Allow States and Victims to Fight Online Sex Trafficking Act, which opponents have said would endanger sex workers and fail to help trafficking victims.

The legislation, passed in 2018, was intended to curb sex trafficking, especially on Backpage.com, and allows victims to sue those websites for facilitating the trafficking. Sex workers argued the legislation actually threatened to increase violence against them because it makes it harder for them to vet their clients and forces them onto the streets to find clients.

Harris responded to her critics, saying she has been advocating for sex workers since she was a district attorney 15 years ago.

"I was advocating then, that we have to stop arresting these prostitutes and instead go after the johns and the pimps, because we were criminalizing the women," she said. "[Backpage] was making money off of the sale of youth. So I called for them to be shut down, and I have no regrets about that."

[Also read: Kamala Harris calls Trump a racist]