WASHINGTON (Reuters) - Republican and Democratic lawmakers on Tuesday introduced legislation that would require border agents to obtain a warrant before searching data held on electronic devices belonging to Americans.

The bill comes amid rising concern among civil liberties advocates about the effect on privacy of border searches of social media information, photos and email held on phones and laptops, which have grown in frequency in recent years and do not require a warrant.

President Donald Trump’s administration has fanned those concerns as it has sought to implement “extreme vetting” security checks to restrict the flow of immigrants and refugees into the United States, an effort that has included consideration of a requirement that visitors share their social media passwords.

In addition to foreign visitors, media reports in recent months have suggested digital data of Americans re-entering the country has also been subject to added scrutiny. Numbers maintained by the Department of Homeland Security show border searches of phones have spiked in recent years, and official documents show the agency is able to extract data from some mobile devices, including those protected by passwords.

Generally, U.S. law enforcement is required to obtain a warrant before it can search electronic devices of an American. A unanimous 2014 U.S. Supreme Court decision affirmed that a search and seizure of an arrested person’s cell phone was unconstitutional without a warrant.

But a so-called “border search exception” allowed federal authorities to conduct searches within 100 miles (160 km) of a U.S. border without a warrant.

The Protecting Data at the Border Act would seek to limit the exception by requiring a warrant before searching devices at the border that belong to a U.S. citizen of permanent resident, except in some emergency circumstances. It would not apply to foreigners with valid U.S. visas who are entering the country or people who are applying for U.S. visas.

The bill would also bar officials from delaying or denying entry into the United States if a person refused to share passwords, personal information numbers, social media or online account information or access credentials.

Democratic Senator Ron Wyden and Republican Senator Rand Paul sponsored the legislation, while Democratic Representative Jared Polis and Republican Representative Blake Farenthold introduced the bill in the House.

Despite attracting bipartisan sponsors, it was not clear whether the measure would be able to earn enough Republican support to advance in the Republican-controlled Congress.

“A border stop shouldn’t be an excuse for extreme surveillance such as downloading the entire contents of your phone,” said Greg Nojeim, senior counsel at the Center for Democracy & Technology, a Washington civil liberties organization that supports the legislation.