The event occurred about 11 p.m. Wednesday at one of the National Guard entrance identification team posts near Sasabe, said National Guard Sgt. Edward Balaban.
He said the troops withdrew safely, no shots were fired and no one suffered injuries.
U.S. Border Patrol officials are investigating the incident and trying to determine who the armed people were, what they were doing and why they approached the post before retreating to Mexico.
The incident occurred in the west desert corridor between Nogales and Lukeville in the vicinity of Sasabe, Balaban said.
"We don't know exactly how many because obviously it took place in the dark," Balaban said. "Nobody was able to get an accurate count."
The Guard troops are not allowed to apprehend illegal entrants.
"We don't know if this was a matter of somebody coming up accidentally on the individuals, coming up intentionally on the individuals, or some sort of a diversion," said Rob Daniels, spokesman for the Border Patrol's Tucson Sector.
The west desert corridor has been the busiest in the Tucson Sector for marijuana seizures since last year.
Agents have seized 124,000 pounds of marijuana there since Oct. 1, Daniels said.
With more Border Patrol agents and National Guard troops patrolling the Arizona section of the U.S.-Mexican border, it has become more difficult to smuggle drugs and people across and "that heightened frustration may have been connected to what took place last night," Daniels said.
Officials will make a decision following the investigation about whether changes need to be made in regard to the entrance identification teams, Balaban said.
Since arriving in mid-June, the Guard has assisted the Border Patrol by manning control rooms, doing vehicle and helicopter maintenance, repairing roads and fences, constructing vehicle barriers and fences and spotting and reporting illegal entrants in entrance identification teams.
There are dozens of National Guard entrance identification teams along the Mexican border, including east and west of both Nogales and Sasabe and on the Tohono O'odham Nation.
The troops stand post on hilltops next to army-green tents and serve as extra eyes and ears for the Border Patrol.