Washington (CNN) 2020 Democratic presidential candidate Beto O'Rourke said Sunday that a Bush-era law criminalizing border crossings should remain in place, pointing to the importance of a "legal mechanism" to hold smugglers accountable.

"In the vast majority of cases, there is no need to incarcerate or to detain migrant families and especially children," O'Rourke said on CNN's State of the Union. "But if somebody is attempting to smuggle human beings into the United States, if they are attempting to cross illegal drugs into this country, I want to make sure that we have the legal mechanism necessary to hold them accountable and to detain them to make sure they do not pose a threat to this country or to our communities. ... I do not think it should be repealed."

O'Rourke's position on immigration draws sharp contrast to that of opponent and fellow Texan Julián Castro. Castro, the former Housing and Urban Development Secretary, unveiled an immigration plan in April that would roll back a series of laws implemented under Presidents George W. Bush and Donald Trump.

Castro said he would repeal Section 1325 of the Immigration and Nationality Act, which was used by the George W. Bush administration to apply a criminal violation -- as opposed to a civil infraction -- to anyone entering the United States illegally. The decades-old law was used by the Bush administration to attempt to curb the number of illegal entrances into the United States, something that Castro wrote needs to end.

As for the immigration plan that O'Rourke rolled out last month, the former Texas congressman told CNN's Leyla Santiago at the time: "I think we go a lot further than really anyone in this plan."

Read More