LIMA, Peru (AP) — A Peruvian judge on Thursday ordered ousted President Pedro Castillo to remain in custody for 18 months as nationwide protests set off by the political crisis showed no signs of abating and the death toll rose to at least 14.

The judge’s decision came a day after the government declared a police state as it struggles to calm the violence that has been particularly fierce in impoverished Andean regions that were the base of support for Castillo, a leftist former schoolteacher, himself of humble roots.

The ouster of the political neophyte whose surprise election last year brought immediate pushback from the political elite has drawn thousands of his loyal supporters to the streets.

Forty people remained hospitalized for injuries suffered during the civil unrest, according to the Ministry of Health.

The protests erupted after Castillo was removed from power by lawmakers last week, following his attempt to dissolve Congress ahead of a third impeachment vote. The crisis has only deepened the instability gripping the country, which has had six presidents in as many years.

Judge Juan Carlos Checkley Soria’s ruling came after Congress stripped Castillo of the privilege that keeps Peru’s presidents from facing criminal charges.

Castillo and his legal team refused to participate in Thursday’s virtual hearing, arguing it lacked “minimum guarantees.” He was represented by a public defender, who said the judge’s decision will be appealed.

Peru’s Supreme Prosecutor Alcides Chinchay said in court Thursday that Castillo faces at least 10 years in prison on charges of rebellion.

Meanwhile, a large group of protesters — and police in riot gear — gathered in central Lima Thursday evening. The government also imposed a roughly dusk-to-down curfew for five days in at least 15 communities, as allowed by the nationwide emergency declaration issued Wednesday.

The protesters were demanding Castillo’s freedom, the resignation of President Dina Boluarte, and the immediate scheduling of general elections to pick a new president and members of Congress. They have burned police stations, taken over an airstrip used by the armed forces and invaded the runway of the international airport in Arequipa, a gateway to some of Peru’s tourist attractions.

Thousands of tourists have been affected by the protests. The passenger train that carries visitors to Machu Picchu suspended service, and roadblocks on the Pan-American Highway stranded tractor trailers for days, spoiling food bound for the capital.

In Cusco, a top tourist destination, people were stuck Thursday at hotels and the airport.

“I was about to return to Ecuador on Monday, and unfortunately, they told us that all flights were canceled due to the protests,” said Karen Marcillo, 28, who has had to sleep at the Teniente Alejandro Velasco Astete airport in Cusco.

The impact on tourism comes as Peru is still recovering from the effects of the pandemic, which reduced visitations last year to 400,000, down from 4.4 million in 2019.

While in office, Castillo spent much of his time defending himself against attacks from an adversarial Congress and investigations ranging from corruption to plagiarism. Now, it remains unclear whether Boluarte — once his running mate and vice president — will get a chance to govern. Just like Castillo, she is a newcomer to politics without a base in Congress.

“She’s doing a good job right now,” said Cynthia McClintock, a political science professor at George Washington University who has studied Peru extensively. “But it’s a big challenge.”

While some protesters “seem to want kind of instability at any cost,” McClintock said, others saw Castillo’s ouster as an opening to express simmering grievances, such as deep inequality, poverty and lack of public services.

Boluarte, though, may be given some breathing room by lawmakers seeking to keep their jobs. They cannot pursue re-election and would be jobless if a general election for Congress is scheduled, as protesters want.

Boluarte on Wednesday sought to placate the protesters by saying general elections could potentially be scheduled for December 2023, four months earlier than the timing she had proposed to Congress just a few days earlier.

All of the protest-related deaths have occurred in rural, impoverished communities outside Lima that are strongholds for Castillo, who himself comes from a poor Andean mountain district and had no prior political experience.

In Andahuaylas, where at least four people have died since the demonstrations began, no soldiers were on the streets Thursday despite the government declaration allowing the armed forces to help maintain public order.

Some grocery store owners there were clearing the roads littered with rocks and burned tires, but planned to close their doors because of the expected protests led by people from nearby rural communities.

Castillo’s move to dissolve Congress came as lawmakers began a third attempt to impeach him since he was elected in July 2021. After Congress voted him out of power, Castillo’s vehicle was intercepted as he traveled through Lima’s streets with his security detail.

Chinchay, the government’s top prosecutor, insisted Castillo was a flight risk, saying he was trying to reach the Mexican Embassy to seek asylum after he left the presidential palace.

“We do not believe that he wanted to go to the Mexican Embassy to have tea,” Chinchay said.

In issuing his ruling, the Judge Checkley said a “concrete flight risk” still exists and “remains latent over time. Besides Castillo’s apparent effort to reach the Mexican Embassy, he cited remarks from Mexico’s president and foreign minister regarding their country’s willingness to offer him asylum, and a jail visit he received from Mexico’s ambassador in Peru.

Castillo’s public defender, Italo Díaz, rejected assertions the former president is a flight risk. He told the judge Castillo’s children and wife depend on him and he could return to his teaching job if freed.

Castillo is being held at a built-for-presidents detention center inside a National Police facility. On Thursday, police in riot gear stood outside the facility as dozens of Castillo supporters gathered throughout the day.

The state of emergency declaration suspends the rights of assembly and freedom of movement and empowers the police, supported by the military, to search people’s homes without permission or judicial order.

Defense Minister Luis Otarola Peñaranda said the declaration was agreed to by the council of ministers.

On Wednesday, Boluarte pleaded for calm as demonstrations continued against her and Congress. “Peru cannot overflow with blood,” she said.

In a handwritten letter shared Wednesday with The Associated Press by his associate, Mauro Gonzales, Castillo asked the Inter-American Commission on Human Rights to intercede for his “rights and the rights of my Peruvian brothers who cry out for justice.” The commission investigates allegations of human rights violations and litigates them in some cases.

___

Associated Press writers Franklin Briceño in Andahuaylas, Peru, David Pereda in Lima and Gonzalo Solano in Quito, Ecuador, contributed to this report.