President Obama sternly warned Congress on Friday that he would veto proposed bipartisan legislation to impose additional sanctions on Iran, saying such a move would undermine talks over Tehran’s nuclear program and risk setting up a military confrontation.

“My main message to Congress at this point is: Just hold your fire,” Obama said during a joint White House news conference with British Prime Minister David Cameron after the two leaders met in the Oval Office.

“I said to my [Senate] Democratic Caucus colleagues yesterday that I will veto a bill that comes to my desk,” Obama said, referring to his appearance Thursday at a party retreat in Baltimore. “And I respectfully request them to hold off for a few months to see if we have the possibility of solving a big problem without resorting potentially to war.”

The United States and Britain are among the nations engaged in talks with Iran aimed at preventing Tehran from developing the capacity to produce nuclear arms. The talks follow significant economic sanctions imposed by the United States and an international coalition.

Members of Congress on both sides of the aisle have called for more sanctions. While Obama said the negotiations, which have stretched on for a year, have less than a 50-50 chance of succeeding, he emphasized that Iran has frozen development of some of its nuclear capability while the talks continue. Obama and Secretary of State John F. Kerry announced recently that the talks would be extended for a few more months after the two sides failed to meet an initial deadline to complete a deal.

Cameron agreed with Obama and acknowledged that he had called U.S. senators to lobby them directly. More sanctions “would fracture the international unity which has been so valuable in presenting a united front to Iran,” Cameron said.

Obama said that if diplomacy fails, other actions will be explored, and it would not immediately spur the United States into a conflict with Iran.

“I am not, repeat, not suggesting that we are in immediate war footing should negotiations with Iran fail,” Obama said.

Sen. Bob Corker (R-Tenn.), chairman of the Senate Foreign Relations Committee, said Friday afternoon that he spoke with Cameron about the issue. Corker is developing additional legislation that would require the administration to gain approval from Congress for a final nuclear deal with Iran.

“I did talk with him about the fact that I felt Congress should be in position to approve any final deal that doesn’t interfere with the negotiations and strengthens the administration’s hand,” Corker said in an interview. “We approve civilian nuclear deals with India and Vietnam. Something of this magnitude, Congress should play a role.”

But Obama said Friday that additional sanctions would give Iran an excuse to break off the nuclear talks while blaming the United States. The president said that if the talks fail to bring a deal, he would be “the first to come to Congress about the need to tighten the screws.”

The remarks came a day after Obama delivered a blunt, face-to-face warning to fellow Democrats at the retreat in Baltimore. The push for more sanctions on Iran enjoys significant support from Democrats, and Sen. Robert Menendez (D-N.J.) is one of the lead authors of a new sanctions bill.

According to people who attended the meeting, a question on Iran from Menendez prompted a blunt exchange between them.

Obama “was very firm and so was Menendez, but it was not heated or contentious,” said one attendee, who was granted anonymity to discuss a meeting that Democrats agreed wouldn’t be discussed publicly.

Obama and Cameron also pledged Friday to strengthen partnerships to protect against cyberattacks that pose national security threats, promising greater information-sharing and beefed up cybersecurity.

Cameron has been critical of companies encrypting information, saying it prevents intelligence agencies from gaining access to data that could be used in counterterrorism operations.

The British leader suggested this week that he would consider banning applications such as WhatsApp or Apple iMessage if intelligence agencies cannot intercept communications.

Obama did not endorse or criticize Cameron’s views on encryption, but the president said that if “we get into a situation in which the technologies do not allow us at all to track somebody that we’re confident is a terrorist . . . that’s a problem.”

The men also spoke of the need to counter extremists in the wake of deadly attacks in Paris last week and police raids in Belgium.

“This phenomenon of violent extremism, the ideology, the networks, the capacity to recruit young people, this has metastasized and it is widespread, and it has penetrated communities around the world,” Obama said. “I do not consider it an existential threat,” he said, but one that will ultimately be destroyed.

The men said that the countries must remain vigilant against the threat and that they would not be cowed by extremist groups, including the Islamic State in the Middle East and Boko Haram in West Africa. Cameron spoke of “countering this poisonous, fanatical death cult of a narrative that is perverting the religion of Islam.”

Obama said one advantage the United States has in combating homegrown terror is that America’s Muslims “feel themselves to be Americans.” The country’s tradition of assimilation is “probably our greatest strength,” he said.

Ed O’Keefe contributed to this report.