As a two-day meeting of NATO allies ended on Wednesday with more promises to stand by Kyiv in its fight against Moscow, the alliance’s secretary general sent a clear message of support to three small nations that have been deeply shaken by Russia’s invasion of Ukraine.

The NATO allies offered on Wednesday to help shore up the defenses in Moldova, Georgia and Bosnia, the secretary general, Jens Stoltenberg, said, adding that all three countries were under pressure from Russia.

“If there is one lesson from Ukraine, it is that we need to support them now,” Mr. Stoltenberg said at a news conference. “It is much better to support them now than when we have seen developments going in the absolutely wrong direction, as we saw with the invasion of Ukraine earlier this year.”

Mr. Stoltenberg spoke after a meeting of NATO ministers of foreign affairs in Bucharest, Romania.

Moldova and Georgia are both former members of the Soviet Union with strong reasons to fear a Russian military intervention. Russian troops invaded parts of Georgia in 2008 and still control South Ossetia and Abkhazia, two secessionist, pro-Russia regions.

Moldova, a neighbor of Ukraine, has struggled for years with its own pro-Moscow breakaway region, the Transnistria, and many of its leaders fear that if Ukraine falls, Moldova will be next. Bosnia, too, has long been plagued by political instability and Russian interference.

All three countries, along with Ukraine, have formally asked to join the alliance, a trend Moscow sees as a threat to its security.

The foreign ministers of the three countries were invited to the final session of the NATO meeting to discuss “shared security concerns and ways to strengthen our cooperation,” Mr. Stoltenberg said.

He said the allies had agreed to “step up” support and training to improve the security and defense institutions in the three countries, although he gave no details.