MEXICO CITY — For the first time in decades, Mexico’s Catholics were forced on Saturday to abandon what many consider the world’s largest religious pilgrimage, in which millions visit Mexico City’s Basilica of Guadalupe on Dec. 12.

The pilgrimage marks the day in 1531 when the Virgin of Guadalupe, patroness of Latin America’s Catholics, is said to have appeared on the hillside behind the basilica. Millions come each year, many walking or biking for days from distant towns.

This year, church officials agreed to close the basilica to prevent the spread of COVID-19, and offered virtual services and candle-lighting to mark the day without gathering.

It was the first time the church has not welcomed huge throngs of the faithful since the modern basilica was being built in the 1970s, and since religious conflict in the 1920s shuttered an older basilica nearby.

Barricades and police blocked the entrance to the vast plaza in front of the basilica. Stores nearby were still selling religious images and candles, but there were few buyers.

Alejandro Castillo, 53, would normally be at the basilica on Dec. 12. But he was satisfied to be at home in his village of San Gregorio Azompa, about 75 miles (120 kilometers) east of Mexico City.

Castillo had managed to visit the basilica just before it closed Wednesday; authorities had encouraged people to come before the closure, to leave flowers or other offerings.

Castillo walked three days, carrying a huge portrait of the Virgin on his back; alongside walked his 11-year-old son.

“It had been years since I made it to the pews” in the vast building, he noted, “because there were always too many people.”

“But this time they gave us permission,” he said. “Thanks to the Virgin.”

The faithful usually come carrying pictures of the Virgin, some advancing on their knees, many fulfilling promises they made in exchange for her help in difficult situations.

Pope Francis has granted an indulgence to Roman Catholics so that they do not have to physically visit the shrine.

Cardinal Carlos Aguiar Retes put it this way: “Let us allow the Virgin to visit us in our homes.”

Instead, the church has set up video and internet links to watch the lighting of candles to the Virgin. The basilica is scheduled to reopen on Monday. But Mexico City is in the grips of what officials called a “coronavirus emergency,” with rapidly rising infection rates and 78 percent of its hospitals full. About 18,600 people are confirmed to have died of COVID-19 in the city of nine million.

But people continue to approach the gates of the basilica.

Schoolteacher Jaqueline Castillo, who is not related to Alejandro Castillo, came to the basilica with a statue of the Virgin, hoping to get it blessed, but was unable to do so.

“We have to obey the instructions, it is sad but at the same time, it is right, what the authorities are doing,” Castillo said. “They are looking out for our health, and that of everybody else.”

For Alejandro Castillo and others, visiting the Virgin is more than a habit; it is an act of devotion. As a child, he said, he suffered abuse and beatings after he was separated from his family; when they were reunited, he promised the Virgin he would return each year. This year he did, even though it wasn’t on Dec. 12.

“I am very content,” he reflected.

AP journalists Diego Delgado and Marco Ugarte contributed to this report.