BUDAPEST — Chancellor Angela Merkel on Monday ruled out any German supply of weapons to Ukraine, but emphasized that Europe must stay united against Russian aggression.

As long as Russia violates international law with its occupation of Crimea and actions in eastern Ukraine, Ms. Merkel said, sanctions against Russia must remain in place.

Even if the Obama administration should decide to provide defensive and even some lethal weapons to Ukraine, as it is reportedly considering, Germany will not follow suit, she said at a news conference, adding: “I am convinced that this conflict cannot be solved militarily.”

Ms. Merkel’s visit to Hungary was her first since Prime Minister Viktor Orban won re-election in 2010. While formally allied with the German leader in the center-right bloc in the European Parliament, Mr. Orban has irked Berlin and other capitals in recent months by cultivating ties with Moscow and pursuing policies that his critics view as authoritarian.