The Nicaraguan National Police said in a statement the four men were caught around 10 a.m. by members of the country's armed forces after entering through an unauthorized crossing point known as La Guasimada in the Cardenas municipality, located on the southwestern border with Costa Rica.
Two of the men were identified as Egyptian nationals while the other two were Iraqi. All four were deported back to Costa Rica by Tuesday night.
The arrests came after an alert attributed to U.S. Homeland Security Investigations that warned of three possible terrorists who had recently arrived in Central America. The identities of three men detained on Tuesday matched the alert, according to Reuters.
The Egyptians were identified by police as Mohamed Ibrahim, 33, and Mahmoud Samy Eissa, 26, while the Iraqis were Ahmed Ghanim Mohamed Al Jubury, 41 and Mustafa Ali Mohamed Yaoob, 29. The first three men arrived in Costa Rica on June 9, according to their immigration documents given to police.
Dates of their entry to Costa Rica had matched the information released in the HSI alert published by Mexican media on Monday, which identified them as possible ISIS members bound for the U.S., Reuters reported.
The three men had entered Costa Rica from Panama, where there was no information about possible risks they may pose, Costa Rica's immigration officials told La Nación newspaper.
Police said the fourth man, Mustafa Ali Mohamed Yaoob, had registered entry in Costa Rica on June 13,
When questioned about the HSI alert on Tuesday, Mexican President Andres Manuel Lopez Obrador said his government was aware of the search for the suspects and was dealing with the matter, Reuters reported. Mexican Public Security Secretary Alfonso Durazo told Telemundo it's "common" to receive such international alerts.
All four were deported back to Costa Rica by Tuesday night, according to Nicaraguan police.