Venezuela's President Nicolas Maduro ordered the vast border with Brazil to be closed on Thursday just days before opposition leaders plan to bring in foreign humanitarian aid.

Maduro made the announcement on state TV, surrounded by military commanders before opposition leaders led by Juan Guaido vowed to bring in U.S. supplies of emergency food and medicine over the socialist president's objections.

"It will be completely closed until otherwise notified, the land border with Brazil. Better to prevent than to be sorry. So I am taking every measure of prevention to protect our people."

Maduro said he's also weighing whether to shut down the border with Colombia.

Tonnes of aid sent by the U.S. and Colombian governments to alleviate shortages is sitting in warehouses on the Colombian side of the border. Brazil's government on Tuesday also pledged to deliver aid.

In televised comments on Thursday, Maduro said the stockpiling was a provocation. "I don't want to take any decision of this type, but I am evaluating it, a total closure of the border with Colombia," he said.

Guaido invoked the constitution to assume an interim presidency on Jan. 23 and denounces Maduro as an usurper who has devastated the country. The economy's size has halved over the past five years.

The move comes as the United Nations High Commissioner for Refugees put the number of refugees and migrants from Venezuela at over three million — a figure it says is growing by 5,000 every day.

The number of refugees + migrants from Venezuela now stands at 3.4 million people.<br>They need support.<a href="https://twitter.com/ACNURamericas?ref_src=twsrc%5Etfw">@ACNURamericas</a> <a href="https://t.co/VwlBNorhHI">pic.twitter.com/VwlBNorhHI</a> —@Refugees

Under Maduro's orders, Venezuela this week blocked air and sea travel between Venezuela and the Dutch Caribbean island of Curacao.

The opposition is vowing to deliver on Saturday large amounts of U.S.-supplied aid warehoused in the Colombian border city of Cucuta, despite orders from Maduro to his armed forces to block their plans.

Maduro denies a humanitarian crisis, accusing the United States of leading a coup to remove him from power and using the "show" of supposed humanitarian aid as military intervention.

Some political analysts say Saturday's border showdown is less about solving Venezuela's needs and more about testing the military's loyalty toward Maduro by daring it to turn the aid away. Guaido has offered future amnesties to military officers who disavow Maduro, though few have so far done so.

Guaido still has not provided details on how the aid will come in. Opposition figures have suggested forming human chains across the Colombian border to pass packages from person to person and fleets of boats arriving from the Dutch Caribbean islands.

Watch as a soldier gives rare insight into Venezuela's military amid political strife: The National spoke to a Venezuelan soldier about the mood within the ranks, and amid political strife in a country whose political future is tied to the military and raising a key question of whether or not soldiers would fire on crowds if ordered to. 3:02

The socialist president is under a mounting challenge by Guaido, who has declared himself acting president on the grounds that Maduro's re-election was invalid.

Guaido is backed by the U.S. and dozens of nations, who say Maduro was re-elected last year in fraudulent elections.