By Richard Cowan and Doina Chiacu

WASHINGTON (Reuters) - Talks on border security funding collapsed after Democratic and Republican lawmakers clashed over immigrant detention policy as they worked to avert another U.S. government shutdown, a Republican senator said on Sunday.

"The talks are stalled right now," Republican Senator Richard Shelby told "Fox News Sunday." He said the impasse was over Democrats' desire to cap the number of beds in detention facilities for people who enter the country illegally.

Efforts to resolve the dispute over border security funding extended into the weekend as a special congressional negotiating panel aimed to reach a deal by Monday, lawmakers and aides said.

Democratic Senator Jon Tester played down any breakdown in talks. "It is a negotiation. Negotiations seldom go smooth all the way through," he told the Fox program. Tester, one of 17 negotiators, said he was hopeful a deal could be reached.

But Shelby put the chances of reaching a deal by Monday at 50-50. No further talks were scheduled, a source told Reuters on condition of anonymity.

The lawmakers hoped to have an agreement by Monday to allow time for the legislation to pass the U.S. House of Representatives and Senate and get signed by President Donald Trump by Friday, when funding for the Department of Homeland Security and other federal agencies expires.

Trump agreed on Jan. 25 to end a 35-day partial U.S. government shutdown without getting the $5.7 billion he had demanded from Congress for a wall along the border with Mexico, handing a political victory to Democrats.

Instead, a three-week spending deal was reached with congressional leaders to give lawmakers time to resolve their disagreements about how to address security along the border.

One sticking point has been the Democrats' demand for funding fewer detention beds for people arrested by U.S. Immigration and Customs Enforcement (ICE) agents. Republicans want to increase the number as part of their drive to speed immigrant deportations.

Story continues

Since he ran for president in 2016, Trump has pledged to stop the influx of undocumented immigrants by building a wall on the border and crack down on immigrants living in the United States illegally by aggressively conducting more deportations.

'DESPERATELY NEEDED'

Democrats proposed lowering the cap on detention beds to 35,520 from the current 40,520 in return for giving Republicans some of the money they want for physical barriers, the source familiar with negotiations said.

But Democrats would create a limit within that cap of 16,500 beds at detention facilities for undocumented immigrants apprehended in the interior of the country. The remainder would be at border detention centers.

By having the interior cap, ICE agents would be forced to focus on arresting and deporting serious criminals, not law-abiding immigrants, a House Democratic aide said on Sunday.

Republicans balked at the Democrats' sub-cap offer, the source said.

Trump weighed in Sunday, saying the Democratic proposal would protect felons. "They are offering very little money for the desperately needed Border Wall & now, out of the blue, want a cap on convicted violent felons to be held in detention!" Trump said on Twitter.

"Claims that this proposal would allow violent criminals to be released are false," the Democratic aide said.

Republican Senator Lindsey Graham, who is close to Trump, warned against limiting beds. "Donald Trump is not going to sign any legislation that reduces the bed spaces. You can take that to the bank," he said on Fox News' "Sunday Morning Futures."

Lawmakers working on a border deal also have not yet nailed down the amount of money to go for physical barriers along the southern U.S. border, the source said.

While a growing number of Republicans in Congress have made it clear they would not embrace another shutdown, White House budget director Mick Mulvaney said he could not rule it out.

"You absolutely cannot," Mulvaney, who is also Trump's acting chief of staff, told NBC's "Meet the Press" on Sunday. "Is a shutdown entirely off the table? The answer is no."

Lawmakers, however, were working to avoid it.

On Friday, some of the negotiators said that if Congress could not pass a border security bill by Friday, they would move to pass another stop-gap funding bill to avert a shutdown and allow more time to reach a border deal.

(Reporting by Richard Cowan, Doina Chiacu, Howard Schneider; Editing by Jeffrey Benkoe)