President Obama, with South Korean President Park Geun-hye, responds to a question from the news media during a joint press conference at the White House. (Shawn Thew/EPA)

President Obama on Friday condemned violence against innocent civilians in Israel and said the Israeli government has a right to protect its citizens.

“We condemn in the strongest possible terms violence against innocent people, and the Israeli government has the right to protect its citizens from knife attacks and violence in the streets,” Obama said.

He called on Israeli Prime Minister Benjamin Netanyahu, Palestinian President Mahmoud Abbas and other leaders “to try to tamp down rhetoric that may feed violence or anger or misunderstanding.” He said that “this kind of random violence isn’t going to result in anything other than more hardship and more insecurity.”

In a wide-ranging news conference held jointly with South Korean President Park Geun-hye, the president also defended the agreement to limit Iran’s nuclear program, despite a recent long-range missile test conducted by the Tehran government.

“Iran has often violated some of the prohibitions surrounding missile testing,” Obama said. He said that the nuclear deal “solves a specific problem. . . . It does not solve the wide range of issues where we have big differences.”

He said the United States would continue to press Iran and make clear “that there are costs to bad behavior.” But he added that the international community is not worse off than it would be if Iran were simultaneously building nuclear weapons.

The news conference followed a meeting between the two leaders.

The United States and South Korea finalized a free-trade agreement in 2011, and Park said Thursday that Korea is interested in joining the Trans-Pacific Partnership trade accord between the United States and 11 Pacific Rim nations.

Another central issue between the two is North Korea and its nuclear weapons program. The South Korean leader raised eyebrows last month when she attended a Chinese military parade in Beijing, sitting with Russian President Vladi­mir Putin and Chinese President Xi Jinping.

Although China remains North Korea’s only international patron, Xi has had a distant relationship with North Korean dictator Kim Jong Un. Park’s appearance at the military parade might have appeared discordant in Washington, but on the Korean Peninsula, the image was “all about how she’s standing next to President Xi, where the North Korean leader should be standing,” said Victor Cha, who served as director for East Asian affairs in the George W. Bush administration.

Park on Friday said that her appearance in Beijing was an effort to mobilize Russian and Chinese support to prod North Korea into giving up its nuclear arsenal.

Asked if the China visit by Park reflected any crack in the U.S.-South Korea alliance, Obama said no. “The alliance is on firmer footing than it’s ever been,” he said. But he said he expected the South Korean leader to “speak up” if China failed to abide by “international rules of the road” in trade or military affairs.

President of South Korea Park Geun-hye, left, participates in a full military honors parade at the Pentagon. (Jim Watson/AFP/Getty Images)

“We don’t want to see those rules of the road weakening,” he said. “That’s not good for anybody, including South Korea.”

Obama was also asked about the Democratic presidential campaign. He declined to favor a candidate, but he said that all of them “share a belief in an economy working for everybody.” Asked about instances in which the Democratic candidates might differ with the administration — over the Trans-Pacific Partnership, for example — Obama said “it is natural and proper for candidates to run on their own vision and their own platform.”