Updated

President Donald Trump on Wednesday signed an executive order to allow children to stay with parents caught crossing the border illegally -- moving to stop the family separations that have triggered a national outcry and political crisis for Republicans.

The measure would allow children to stay in detention with parents for an extended period of time. This comes as congressional Republicans scramble to draft legislation to address the same issue, but face challenges mustering the votes.

In signing the measure, Trump said he wants to keep families together while also enforcing border security. He vowed his administration's "zero tolerance" policy for illegal immigration would continue.

Trump, previewing the measure earlier in the day during a meeting with lawmakers, said the move would "be matched by legislation." He also said he's canceling the upcoming congressional picnic, adding: "It didn't feel exactly right to me."

More on this...

The separations stem from the administration's "zero tolerance" immigration policy, which aims to prosecute all illegal border crossers. But because of a 1997 order and related decisions, children cannot be detained for longer than 20 days with the adults.

Sources told Fox News that the executive action by Trump could be seen to run afoul of the 1997 order and would likely draw a lawsuit. But the White House wants to try to take steps to uphold the enforcement of the law, while at the same time lessening the trauma of children being separated from their parents.

In another possible approach, Fox News is told Homeland Security Secretary Kirstjen Nielsen will recommend to Trump that he throw his support behind developing House legislation or, if that doesn't pass, a standalone bill to close the “loopholes” regarding family detention. During the order-signing, Nielsen again called on Congress to act.

These measures are being pursued following days of escalating calls from both sides of the political divide for Trump, or Congress, to end the controversial family separation policy.

Rep. Peter King of New York became the latest Republican to join the chorus on Wednesday when he called on Trump to suspend the family separation policy if House immigration legislation does not pass.

Speaking on Fox News’ “America’s Newsroom,” King said that while he agrees with the president’s goals in regards to immigration, the current policy of separating migrant children from parents charged with entering the country illegally is “really terrible for families.”

Republicans in both the House and Senate are struggling to shield the party's lawmakers from the public outcry over images of children taken from migrant parents and held in cages at the border. But they are running up against Trump's shifting views on specifics and his determination, according to advisers, not to look soft on his signature immigration issue, the border wall.

“The Democrats do not have a strong policy,” King said on Fox News. “But at the same time we are playing into their hands by allowing this to happen.”

House Speaker Paul Ryan, R-Wis., said that the House will vote Thursday on legislation to allow families to remain together in Homeland Security custody throughout their legal proceedings.

“We do not want children taken away from their parents,” Ryan said. “We can enforce our immigration laws without breaking families apart.”

That followed a closed-door meeting in Washington on Tuesday evening, where Trump told House Republicans he is "1,000 percent" behind their rival immigration bills. But it's unclear whether any bill has enough support to pass.

Under the administration's current policy, all unlawful crossings are referred for prosecution — a process that moves adults to the custody of the U.S. Marshals Service and sends many children to facilities run by the Department of Health and Human Services. Under the Obama administration, such families were usually referred for civil deportation proceedings, not requiring separation.

More than 2,300 minors were separated from their families at the border from May 5 through June 9, according to the Department of Homeland Security.

In the House, GOP leaders scrambled Tuesday to produce a revised version of the broader immigration bill that would keep children in detention longer than now permitted — but with their parents.

The major change unveiled Tuesday would loosen rules that now limit the amount of time minors can be held to 20 days, according to a GOP source familiar with the measure. Instead, the children could be detained indefinitely with their parents.

The revision would also give the Department of Homeland Security the authority to use $7 billion in border technology funding to pay for family detention centers, said the person, who was not authorized to discuss the matter by name and commented only on condition of anonymity.

In a statement late Wednesday, U.S. Customs and Border Protection said it has taken "immediate steps" to implement the president's executive order.

"As specified in the order, families will not be detained together when doing so would pose a risk to the child’s welfare," the statement read in part. "Additionally, as was the case prior to implementation of the zero tolerance policy on May 5, family units may be separated due to humanitarian, health and safety, or criminal history in addition to illegally crossing the border.”

Even if Republicans manage to pass an immigration bill through the House, which is a tall order, the fight is all but certain to fizzle in the Senate.

Sen. Chuck Schumer, the Democratic leader from New York, is adamant that Trump can end the family separations on his own and that legislation is not needed.

Without Democratic support, Republicans cannot muster the 60 votes needed to move forward on legislation.

Democratic reticence and their opposition to a border wall have come under intense scrutiny from Trump, who has blamed the party for the failure of Congress to pass immigration reform.

“It’s the Democrats fault, they won’t give us the votes needed to pass good immigration legislation,” Trump tweeted on Wednesday. “They want open borders, which breeds horrible crime. Republicans want security. But I am working on something - it never ends!”

On the Senate side, Republicans are rallying behind a different approach. Theirs is narrow legislation proposed by Sen. Ted Cruz, R-Texas, that would allow detained families to stay together in custody while expediting their hearings and possible deportation proceedings.

Cruz's bill would double the number of federal immigration judges, authorize new temporary shelters to house migrant families and limit the processing of asylum cases to no more than 14 days — a goal immigrant advocates say would be difficult to meet.

Senate Majority Leader Mitch McConnell, R-Ky., told reporters he's reaching out to Democrats for bipartisan backing.

The discord over the family separation spilled into the streets as protesters clashed with law enforcement in Philadelphia and other cities on Tuesday -- and Democratic lawmakers accosted senior administration officials and even the president himself over the policy.

As Trump walked out of the session in the Capitol basement, he was confronted by about a half-dozen House Democrats, who yelled, "Stop separating our families!"

Later in the day, protesters heckled Homeland Security Secretary Nielsen as she ate dinner at a Mexican restaurant in Washington, chanting "Shame!" and "End family separation!"

A department spokesman tweeted that during a work dinner, the secretary and her staff heard from a small group of protesters who "share her concern with our current immigration laws."

The Associated Press contributed to this report.