Training at Otis Air National Guard Base. (Tech. Sgt. Lindsey Sarah Watson-Kirwin /U.S. Air National Guard handout)

Three missing Afghanistan National Army officers, who disappeared while participating in a training program in Massachusetts, were detained while attempting to cross the border into Canada and have been transferred to U.S. custody by the Canada Border Services Agency, a spokeswoman for U.S. Customs and Border Protection said on Monday.

The men were detained while attempting to enter Canada at Rainbow Bridge, which connects the cities of Niagara Falls in New York and Ontario, said David Procopio, a Massachusetts State Police spokesman.

Procopio said officials with the Massachusetts State Police, which assisted in the search for the three officers, were notified on Monday that the men had been located and would be questioned by U.S. authorities.

The men — Maj. Jan Mohammad Arash, Capt. Mohammad Nasir Askarzada and Capt. Noorullah Aminyar — were in the United States to conduct joint military exercises at a base in Cape Cod. They went missing on Saturday during a trip to the Cape Cod Mall in Hyannis.

Their disappearance marked the second time this month that a group of Afghan trainees had gone missing while participating in programs in the United States.

In the latest incident, the three members of the Afghanistan National Army were reported missing after taking a trip to a shopping mall in Hyannis, according to CNN.

The three men were part of a group of 15 soldiers and officers from Afghanistan participating in annual joint exercises on Otis Air National Guard Base. Along with nearly 200 others from six countries, they were participating in military training exercises with the National Guard, Massachusetts National Guard spokesman James Sahady told the Boston Globe.

The program has been held every year since 2004.

The three men who went missing are senior military officers who had been cleared by the State Department to participate in the exercises, Sahady said.

“There is no indication that they pose any threat to the public,” Sahady said, according to the Boston Herald.

This second incident came just days after two Afghan police officers training with the Drug Enforcement Administration in Quantico, Va., disappeared while on a tourism day trip to Washington on Sept. 13. The two men, Mohammad Yasin Ataye, 22, and Mohd Naweed Samimi, 24, were found on Sept. 18 in Buffalo, N.Y., where authorities believe they were trying to reunite with family.

DEA spokesman Rusty Payne noted that the men were chosen to participate in the training program because they were among “the best and brightest” in their country, according to CBS, which added:

According to the DEA, each candidate is extensively vetted and polygraphed. Ataye and Samimi entered the U.S. in mid-August with special visas and were participating in the DEA’s Sensitive Investigative Unit Program (SIU) which offers law enforcement agents from 13 countries training in surveillance, undercover operations and intelligence gathering among other things. Classes are taken on field trips on weekends.

[This post has been updated.]