Soldiers patrol inside Galeão International Airport on Wednesday ahead of the 2016 Olympic Games in Rio de Janeiro. (Dado Galdieri/Bloomberg News)

Brazilian police have arrested 10 people suspected of planning terrorist attacks during the Rio Olympics, Brazilian prosecutors said Thursday.

The 10, all Brazilians, had declared loyalty to the Islamic State and were communicating via cellphone messenger services Telegram and WhatsApp to plan attacks during the Summer Games, which open Aug. 5, Justice Minister Alexandre de Moraes told reporters. The arrests took place in 10 different states, and police issued arrest warrants for two more suspects.

“Operation Hashtag, triggered by federal police this Thursday morning, investigates the possible participation of Brazilians in a criminal organization with international reach, as an Islamic State cell in this country,” the prosecutor’s office in Paraná said in a statement. It added that “12 arrest warrants for temporary custody of 30 days were issued and may be extended for 30 more.”

De Moraes said the group’s leader was based in Curitiba, capital of Paraná state.

Only four of the suspects had met personally, but they had declared loyalty to the Islamic State and discussed shooting weapons and practicing martial arts, de Moraes said. One had begun negotiations to buy an AK-47 assault rifle over the Internet, he said.

“Apparently . . . it was an absolutely amateur cell with no preparation,” de Moraes said.

He added that “one of them that we managed to rapidly trace entered into contact with a site of clandestine arms sales in Paraguay, looking to buy an AK-47 rifle to carry out an operation. This moment is crucial because it demonstrates an act of preparation,” de Moraes said.

Small arms are easily available in Paraguay, which has a porous border with Brazil. Brazilian Intelligence Agency (ABIN) officials have expressed concern about the ease with which a “lone wolf” terrorist could buy arms there and bring them to Brazil. Traffic from the Paraguyan border city, Ciudad del Este, to Foz de Iguaçu in Brazil frequently does not even get stopped, despite regular arms smuggling.

Members of the cell acknowledged that Brazil is a neutral country that is not part of the U.S.-led coalition attacking the Islamic State in Iraq and Syria, but they said Brazil was a target because it would be hosting many foreigners during the Olympic Games, de Moraes said. The members of the group called themselves “Defenders of Sharia,” the minister said.

The suspects were arrested across Brazil in the states of Amazonas in the Amazon; Ceará and Paraíba in the northeast; Goiás and Mato Grosso in the interior; Minas Gerais, Rio de Janeiro and São Paulo in the southeast; and Paraná and Rio Grande do Sul in the south, a Justice Ministry spokesman said. About 130 officers took part in the arrests, the spokesman said.

The arrests come at a time of mounting concern over the possibility of a terrorist attack in Brazil.

ABIN said it had monitored a threatening tweet posted by an Islamic State member after the November terrorist attacks in Paris that killed 130 people. “Brazil you are next,” it warned.

This month, the SITE Intelligence Group, which monitors terrorist activity, reported that pro-Islamic State messages were being exchanged via Telegram in Portuguese and that propaganda had been translated into Portuguese.

Brazilian security forces have been carrying out anti-terrorist drills in Rio ahead of the Games.