RIYADH, Saudi Arabia — As millions of Muslims begin arriving in Mecca for this year’s pilgrimage, Saudi officials face a unique challenge: how to prevent this sacred rite from becoming an inadvertent incubator and global transmitter of swine flu.

The conditions that will arise during the pilgrimage, or hajj, which officially begins in the last week of November, are the exact opposite of what health officials like to see.

An estimated 2.5 million people from up to 160 countries — including perhaps 15,000 from North America — will walk, pray and eat in close proximity to each other for several days. They will touch the same religious objects and sleep in crowded tent cities. Some, inevitably, will arrive carrying the new virus strain, H1N1.

Unable to alter these conditions, Saudi health officials have been working feverishly for months to minimize the risks. It has been a delicate balance between maintaining unrestricted movement for one of Islam’s holiest rites, and imposing measures to retard rampant transmission of the virus.

In June the World Health Organization declared swine flu, first detected in April, to be pandemic, meaning it had reached much of the world. As of Oct. 17, the WHO reported more than 414,000 cases and nearly 5,000 deaths from the disease.

By Nov. 2, Saudi Arabia had 62 deaths and about 5,000 cases of confirmed or suspected swine flu, according to Khaled Al Marghalani, spokesman for the Ministry of Health.

Epidemiologists are watching swine flu carefully to detect if it blends with other strains or mutates into an even newer, more resilient strain that could produce more deadly outbreaks.

Large, dense concentrations of people such as the pilgrimage create conditions for such mutations. And pilgrims who become infected during the hajj could bring it home, triggering new outbreaks.

Al Marghalani said in an interview that ministry officials “feel very confident” that they have done as much as they can to prepare for the hajj.

He said the Saudis invited international epidemiological experts, including staff from the U.S. Centers for Disease Control and Prevention, to a June meeting in Jeddah. The participants inspected airports and seaports that will receive the pilgrims and made recommendations on preventing, spotting and containing flu outbreaks.

One recommendation, which the Saudis adopted and Arab health ministers endorsed, was for high-risk people to avoid this year’s pilgrimage. That group includes those younger than 12, older than 65, pregnant women and those suffering from diabetes and chronic diseases of the heart, kidney, lungs or nervous system.

The Saudis stress this is advisory only. “We will not prevent anybody from coming in if they get approval from their country,” said Dr. Ziad A. Memish, assistant deputy minister for preventive medicine, in a recorded interview posted at the website of Science magazine.

The hajj, which lasts four to five days, is one of Islam’s five pillars, required of all physically and financially able Muslims. Each country is assigned a quota of hajj visas that it receives from the Saudis.

Al Marghalani said the government also highly recommends prospective pilgrims get seasonal flu shots. And if a country has received swine flu vaccine in enough time to inoculate pilgrims before they depart for Mecca, the Saudis may require they be vaccinated prior to getting a visa.

However, few countries are in that position. An article in Science magazine on hajj preparations written by Memish and CDC staff noted that because of manufacturing delays, as of Oct. 22, only four countries had indicated they planned to vaccinate their pilgrims.

The kingdom has received an initial shipment of swine flu vaccine, and next week will start vaccinating health workers and local residents who plan to attend this year’s hajj, Agence France Presse reported Monday.

The Science article also said that arriving pilgrims will be given kits containing masks, hand sanitizers and informational materials explaining how the virus is spread by airborne particles and physical contact.

Thermal sensors at airports will detect arrivals with a high fever. The Saudi health ministry “has recommended that each receiving airport have the holding capacity for 200 to 300 pilgrims to evaluate those who are symptomatic with influenza-like illness,” said the June workshop report.

But officials are avoiding any mention of “quarantine,” the report added, partly because of fears it would discourage ill pilgrims from coming forward, and partly because of the “risk of politicizing Hajj negatively as people may feel discriminated if quarantined.”

If tests confirm an arriving pilgrim has the flu, they will be treated with anti-viral medicine — at Saudi expense.

Meanwhile, 76 clinics and 7 hospitals in and around Mecca will be fully staffed during the pilgrimage. And for the first time, spokesman Al Marghalani said, field medics will be equipped with hand-held web-linked devices to instantly alert a central medical command when they find a sick pilgrim. This will give a real-time, geographic picture of where outbreaks may be starting, allowing a rapid response to contain them.

While the prevention effort this year will be more intense, it is not unprecedented. “We have had experience with communicable and non-communicable diseases during the hajj for more than 50 years, so we’ve got a lot of experience,” Al Marghalani said.

Every year, Saudi health officials monitor epidemics around the world and require prior vaccination for visitors from affected areas, he said. Meningitis, polio, dengue fever and yellow fever are top concerns.

Also, the government issues a yearly report summing up the major health issues of the last pilgrimage. “They are very transparent,” said Awad Abu Zeid Mukhtaar, WHO’s representative in Riyadh. “Whenever they have cases, they report it.”

Saudi officials were encouraged when a wave of almost 2 million visitors to Mecca during the holy month of Ramadan in mid-September passed with only 26 cases of swine flu and no deaths.

However, the upcoming hajj will be more unpredictable. It will bring many more pilgrims from developing countries with weak health systems, as well as visitors from the northern hemisphere when its flu season will be in full swing.