NATO leaders pledged their “unwavering commitment” to boost defense spending on Wednesday, following stern words from President Trump criticizing European leaders for spending too little.

The U.S. and European allies signed a declaration stating they are “committed to improving the balance of sharing the costs and responsibilities of alliance membership.”

The declaration comes after confrontational and testy discussions between Trump and other NATO leaders.

Since the election, Trump has criticized NATO countries for not paying their fair share, while suggesting he would only come to the defense of NATO nations that fulfilled their financial obligation.

Trump also has pressed NATO countries to fulfill their goal of spending 2 percent of their gross domestic products on defense by 2024. NATO estimates that 15 members, or just over half, will meet that benchmark based on current trends.

As NATO vows to pursue those targets, Trump is seeking even more.

Via Twitter, he called for members to meet the 2 percent commitment immediately. And in a statement Wednesday, White House Press Secretary Sarah Sanders said Trump, at the summit, "suggested that countries not only meet their commitment of 2 percent of their GDP on defense spending, but that they increase it to 4 percent. Trump wants to see our allies share more of the burden and at a very minimum meet their already stated obligations."

Before sitting down for the first official meeting of the day, the president engaged in a testy exchange with NATO Secretary General Jens Stoltenberg. He pressed why the U.S. should continue to pay money to the military alliance while the countries purchase energy from Moscow.

“We are stronger together,” Stoltenberg said, while acknowledging there can be differences among allies.

“But how can you be together when you’re getting energy from the group you want protection from?” Trump responded, using Germany as an example. Trump challenged Stoltenberg to explain why Berlin was getting energy from Russia, and asserted that Germany was “totally controlled” by and “captive to Russia” over a pipeline project.

That pipeline project, Nord Stream 2 pipeline, doubles the amount of gas Russia can send directly to Germany, while sidestepping transit countries like Ukraine. The project is opposed by the U.S. and some European Union members.

“We’re supposed to protect you against Russia and yet you make this deal with Russia,” Trump said of Germany. “Explain that. It can’t be explained.”

Trump followed up on Twitter: "What good is NATO if Germany is paying Russia billions of dollars for gas and energy? Why are there only 5 out of 29 countries that have met their commitment? The U.S. is paying for Europe’s protection, then loses billions on Trade. Must pay 2% of GDP IMMEDIATELY, not by 2025."

Former Secretary of State John Kerry later blasted Trump’s comments about Germany as “strange” and “counterproductive.”

“It was disgraceful, destructive, and flies in the face of the actual interests of the United States of America,” Kerry said in a statement, claiming Trump “set America back this morning.”

“He is steadily destroying our reputation in the world,” Kerry said, adding that Trump displayed a “woeful ignorance” of European defense spending.

Anticipation has built for weeks over how confrontational the meeting might be, given the U.S. president's complaints about trade and NATO allies' military budgets -- and how the summit might compare with Trump's scheduled meeting in Finland with Russia's Vladimir Putin.

That meeting has riled Democrats in Washington amid the probe over Russian meddling in the election. Senate Minority Leader Chuck Schumer tweeted Wednesday, "President Trump should not meet with President Putin alone."

The summit in Brussels is the first stop on Trump’s four-country European tour where tensions already have risen over tariffs and the potential trade war between the European Union and the U.S. Trump implemented tariffs of 25 percent on steel and 10 percent on aluminum imports, and the EU is pushing to retaliate.

The president met first with French President Emmanuel Macron, who said the U.S. and France "will continue to work together." Trump said they discussed their "tremendous relationship," and talked about trade.

Trump also met with German Chancellor Angela Merkel. The president told reporters they discussed military spending and trade, and touted their "good relationship."

The next stop on the president’s tour will be Britain, amid a tumultuous climate for Prime Minister Theresa May. May’s government is in turmoil over her plans for exiting the European Union.

This week, U.K. Foreign Minister Boris Johnson stunningly resigned amid the growing backlash over May and her handling of Britain’s departure from the EU. Johnson resigned less than 24 hours after Brexit Secretary David Davis and junior Brexit minister Steve Baker left their posts in protest of how the government is handling Brexit.

Trump suggested Tuesday that he may meet with Johnson when he gets over there. Trump, who has been vocal in his support of Brexit, is slated to meet with May on Friday.

Trump’s tour will continue with a stop in Scotland over the weekend, then conclude with his final stop in Helsinki, Finland on Monday for his highly anticipated summit with Russian President Vladimir Putin.

Trump suggested that his meeting with Putin could be the “easiest” stop on the European tour, after confrontational talks with NATO and EU leaders.

Fox News’ Edmund DeMarche, Kristin Brown, and The Associated Press contributed to this report.