Republicans and Democrats in Congress pushed the Obama administration on Tuesday to immediately require background checks of social media for all foreigners seeking U.S. visas — a move they say might have helped foil the San Bernardino attack.

Tashfeen Malik, a Pakistani woman who the FBI says carried out the California attack with her husband, came to the United States in 2014 on a K-1, or fiancé, visa. The history of Malik's radicalization and her apparent online discussions about jihad have raised concerns about how she was able to pass a background check that the government has described as rigorous.

The administration currently is reviewing the visa vetting process, but Homeland Security Secretary Jeh Johnson told Politico on Tuesday that there are "certain legal limits" that restrict how federal investigators can comb social media histories of foreigners seeking visas.

"We are dealing with private communications and things for which there is an expectation of privacy, and you're dealing with U.S. persons," Johnson told the news outlet. "There are certain legal limits to what we can do. ... We are looking at, now, ways in which we can — consistent with law and civil liberties and privacy — expand upon that. This is something we've been doing for months now."

Moreover, allowing people who vet visa applicants to review social media postings is no guarantee that a would-be immigrant who has radicalized views will be discovered. Facebook and Twitter users can make their pages private and aliases are routinely employed.

On Capitol Hill, 21 Senate Democrats plus Sen. Angus King, an Independent from Maine, wrote a letter Tuesday to Johnson saying that while the department has the ability to investigate social media postings, it does so inconsistently.

"We believe these checks, focused on possible connections to terrorist activity, should be incorporated into DHS's vetting process for visa determinations, and that this policy should be implemented as soon as possible," the letter said.

On the Republican side, GOP Sen. John McCain of Arizona introduced legislation on Tuesday that would require the department to search social media websites and publicly available information of prospective foreign travelers or immigrants seeking to enter the United States. He too said that the department does not routinely review social media platforms as part of its background checks.

"It is unacceptable that Congress has to legislate on this, and that it wasn't already the Department of Homeland Security's practice to take such commonsense steps when screening individuals entering this country," McCain said.

Earlier, Rep. Bob Goodlatte, R-Va., said the House Judiciary Committee was crafting legislation that would require online information, including social media accounts, be reviewed as part of the background check for visa applicants, including K-1 visas.

The Obama administration has directed the Homeland Security and State departments to review the process for screening visa applicants and recommend ways to close security gaps in the system. The Homeland Security Department said three pilot programs to specifically incorporate "appropriate" social media reviews into its vetting process were launched in the last year and the department is looking at other ways to use social media posts.

White House spokesman Josh Earnest said he's not sure that any legislation would be needed to require the department to look at social media accounts during the visa vetting process.

The administration has "acknowledged that part of that review is to consider ways to incorporate the use of social media vetting in their screening programs," Earnest said. "We'll leave it to the experts to determine the best way to strengthen the security of our screening programs."

Malik's background check included at least one in-person interview from her native Pakistan and another after marrying the second attacker, Syed Farook, who was born in Illinois. She also had to provide fingerprints and a variety of background information. Authorities also vetted her, using intelligence and law enforcement databases.

The day after the attack, Facebook found a post on a page maintained by Malik pledging her and Farook's allegiance to the leader of the Islamic State group. The page was under an alias. Authorities have said Malik and Farook exchanged messages about jihad and martyrdom online before they were married and while she was living in Pakistan.