The expulsion does not affect the embassy's US military attache, said an American official, who insisted on not being quoted by name because he was not authorized to disclose the information. He said Friday that the group's members had not yet left the country.

President Rafael Correa publicly complained in January that Washington had too many military officers in Ecuador, claiming there were 50, and said they had been "infiltrated in all sectors." At the time, he said he planned to order some to leave.

President Correa was in Spain on Friday and made no public comment about the issue. Foreign Minister Ricardo Patino also was in Europe, a ministry official said, saying only Mr. Patino could comment.

Shortly after taking office in 2007, Correa purged Ecuador's military of officers deemed to have close relations with US counterparts. He also ended an agreement with Washington that allowed US drug interdiction flights to be based at the Ecuadorean airfield in Manta.

The US Embassy spokesman said the military group being expelled has 20 Defense Department employees, not all of them uniformed.

Mr. Weinshenker said Washington provided $7 million in security assistance to Ecuador last year, including technical training for maintaining aircraft and cooperation in combating drug trafficking, human trafficking and terrorism. Building relationships with counterparts in partner nations' militaries is a big part of such missions, particularly as US commercial influence ebbs in the region.

Although it has shrunk during Correa's administration, US military cooperation in Ecuador dates back four decades, and Weinschenker said that "all the activities we have carried out have had the explicit approval of our Ecuadorean counterparts."

US relations with the Correa government suffered strains even before Correa provided asylum in 2012 to WikiLeaks founder Julian Assange, whose organization published troves of leaked US military documents and diplomatic cables highly embarrassing to Washington.

Correa accused Washington, a close ally of neighboring Colombia, of meddling in Ecuador's military and police, and he previously expelled at least three US diplomats, including then Ambassador Heather Hodges in 2011. Amb. Hodges was the victim of a cable divulged by WikiLeaks that suggested Correa was aware of high-level police corruption and did not act on it.