Brazilian Federal Police officers escort one of the 10 people they arrested on suspicions of ties to Islamic State in Sao Paulo Thomson Reuters

Brazil has now captured 12 ISIS sympathizers accused of trying to mount attacks on the Olympic Games slated to begin on August 5 in Rio de Janeiro.

The suspects were apprehended in an operation that not only involved assistance from US authorities, but the help of Facebook and Twitter.

Last week, Brazilian police rounded up 10 suspects in different locations around the country.

On Friday, an 11th suspect turned himself, and the 12th and final member of what Brazil's justice minister called a group of "absolutely amateur" plotters was caught by military police in the city of Comodoro, in the western state of Mato Grosso, officials said.

Justice Minister Alexandre de Moraes said some of the men had pledged allegiance to the ISIS without having any personal contact with members of the terrorism group. The suspects had never received any training nor been to Iraq or Syria.

"They were complete amateurs and ill-prepared" to mount an attack, Moraes said last week. "A few days ago they said they should start practicing martial arts, for example."

The group, which Moraes called a "cell," never met in person, did not have any bomb materials or funding, and had tried to buy an AK-47 from Paraguay online, according to Univision. The suspects also didn't know each other and only communicated via messaging apps WhatsApp and Telegram.

The group allegedly attempted to form an extremist cell called Defenders of Sharia, but they didn't have formal ties to ISIS.

Operation Hashtag

Sao Paulo state police take part in a simulated hostage situation during a security exercise ahead of the 2016 Rio Olympics, in the airport of Sao Jose dos Campos, Brazil, July 21, 2016. REUTERS/Roosevelt Cassio

Brazilian authorities revealed the antiterrorism operation when they announced the arrests on Thursday. Brazilian federal police said in a statement that Operation Hashtag, as it was known, had started in April and involved phone taps and monitoring the suspects' postings on social media.

After the initial arrests, a Brazilian prosecutor revealed that the US FBI had also aided the investigation, providing tips on six individuals in May.

"The information came from the FBI," Rafael Brum Miron, the federal prosecutor handling the case in the southern state of Parana, told the Estado de S. Paulo newspaper. "They sent a succinct report: These people merit investigating."

In an interview broadcast late on Sunday, a Brazilian judge said that Facebook and Twitter had both assisted the investigation, as well.

Judge Marcos Josegrei da Silva, who is overseeing the case, said cooperation by both social-media companies, after a judicial order tied to the investigation, was vital to understanding the nature of discussions the suspects had.

"The companies began to provide data related to the content of the conversations and data about where those conversations were posted," the judge said, according to Reuters, but without offering more details.

Brazilian Public Safety National Force, left, and military-police soldiers guard an entrance at the security fence outside the 2016 Rio Olympics Park in Rio de Janeiro, Brazil, July 21, 2016. REUTERS/Fabrizio Bensch

The arrests not only come just days before the opening of the 2016 Rio games. They also take place amid an ongoing debate about the needs of law enforcement in a country dealing with high crime rates and the public's right to communicate without interference.

Brazil and WhatsApp have clashed several times in recent months, with authorities implementing several nationwide bans on the app for its failure to provide information on suspected criminal activities to Brazilian authorities. (Brazilian courts have overturned each ban relatively quickly.)

WhatsApp, which is owned by Facebook, offers encrypted communications, and the company says that even it cannot access the conversations Brazilian authorities have requested to see. (Vincent Bevins, the LA Times correspondent in Brazil, says police likely monitored the suspected ISIS militants by infiltrating the WhatsApp groups they used.)

Da Silva, the judge managing the case, also said others beyond the 12 in custody could be involved. Brazil plans to deploy 85,000 armed police and soldiers to the streets of Rio to provide security, though the threat of street crime and crimes of opportunity remain.