MADRID — The global battle to contain the coronavirus reached a new level of urgency Monday, as governments locked down borders, a new wave of closures and restrictions kept more than 500 million students at home, and pleas went out to funnel masks and ventilators to places struggling with soaring caseloads.

The growing sense of crisis rocked global financial markets, particularly on Wall Street, where the Dow Jones Industrial Average plunged 12.9 percent. Investors’ fears that the outbreak will throw the global economy into a recession sent the market to its worst one-day loss since 1987.

The shifting fronts in the battle were made clear by figures showing that cases outside China — where the virus originated — surpassed those inside its borders for the first time. Spain officially became the fourth-most infected country in the world, surpassing South Korea.

With the number of cases worldwide topping 181,000, a surge of patients in Madrid’s hospitals fueled worries across Europe of what lies ahead.

“There is no easy or quick way out of this extremely difficult situation,” said Mark Rutte, the prime minister of the Netherlands, in the first televised speech by a Dutch premier since 1973.

Only China, Italy and Iran have more confirmed cases of COVID-19 than Spain, where the number of infections increased overnight by roughly 20%, to 9,191, and the number of fatalities rose to 309, according to the Spanish Health Ministry. The actual figure was presumed to be even higher, because Spain switched to a new system of reporting.

A somber Rutte told viewers that “a large part” of the Netherlands’ 17 million people are likely to contract the virus. So far, 1,413 people have tested positive and 24 have died. The government has ordered schools, restaurants and bars closed until April 6 and banned gatherings of more than 100 people.

Countries from Canada to Switzerland, Russia and Malaysia announced sharp new restrictions on the movement of people across their borders.

“We have a window of time at the moment to slow the spread of the virus,” said Ulrike Demmer, a spokeswoman for Germany’s government, which reversed its earlier insistence that border controls would not work. It imposed new limits on crossings with France, Austria, Switzerland, Denmark and Luxembourg, after cases of the virus increased by more than 1,000 over 24 hours.

With much-needed ventilators in short supply, the British government asked manufacturers, including automakers Ford and Rolls-Royce, to convert some of their assembly lines to making the life-saving equipment.

“We are facing what is an unprecedented situation and that is going to require an unprecedented response,” said James Slack, a spokesman for Prime Minister Boris Johnson.

Around the world, fast-changing rules and restrictions tore up the script for daily life.

Ireland ordered all pubs and bars to close for two weeks — including on Tuesday, St. Patrick’s Day.

In the Croatian capital of Zagreb, officials in charge of the city’s cemeteries restricted attendance at funerals to only the closest relatives of the deceased, to avoid spreading the virus.

In the U.S., casinos went dark not just in Las Vegas, but in at least 14 other states. From Alaska to New York, restaurants and bars were ordered either to shut down or to restrict their services to delivery and takeout.

Malaysia’s leader announced a sweeping lockdown, with travel in and out of the country banned for two weeks and only essential services allowed to stay open. The first confirmed cases of COVID-19 were reported in Somalia, which has one of Africa’s weakest health systems after nearly three decades of conflict between the government and the al-Qaida-linked al-Shabab extremist group.

In France, officials imposed nationwide restrictions on where people could go, allowing them to leave home only to buy food, go to work, or do other essential tasks.

French President Emmanuel Macron said the government ordered the restrictions because people hadn’t complied with earlier guidelines and “we are at war.”

School closings in 56 countries kept more than 516 million students home, the United Nations said. New York City joined those ranks Monday, closing a school system with 1.1 million students.

European Commission President Ursula von der Leyen suggested a 30-day ban on people entering the bloc for non-essential travel reasons.

“The less travel, the more we can contain the virus,” she said in a video message.

A number of EU member countries have, so far, resisted such far-reaching controls. But many went ahead Monday with measures to sharply curtail activities inside their borders.

In Switzerland, the city-state of Geneva banned gatherings of more than five people, though exceptions were made for business meetings that followed public health rules.

Switzerland’s government declared a state of emergency, ordering shops, restaurants, bars and other facilities shut down. The measures exclude health-care operations as well as supermarkets, but also include entertainment and leisure facilities, which will be closed until April 19.

“We need to do everything possible to slow the advance of the coronavirus,” Swiss President Simonetta Sommaruga said, urging people to practice social distancing and follow government guidelines.

In the United States, officials urged older Americans and those with chronic health conditions to stay home, and recommended functions be capped at 10 people.

Americans returning from abroad encountered chaotic airport health screenings that clearly broke all virus-fighting rules against having packed crowds close together.

For most people, the coronavirus causes only mild or moderate symptoms, such as fever and cough. But severe illness can occur, especially in the elderly and people with existing health problems. Worldwide, more more than 7,000 people have died. Over 78,000 have recovered, most of them in China.

Still, some countries have resisted more stringent measures to contain the virus.

In Britain, bars and restaurants remained open and there was no ban on large events. The prime minister’s spokesman said closing schools hadn’t been ruled out, but “the scientific and medical advice is that that’s not a step which we should be taking at this point in time.”

In China, thousands of workers headed back to jobs at factories desperate to get production going again, as the virus ebbed. In South Korea, only 74 more cases were reported.

But authorities urged vigilance to keep hard-won gains against the microscopic foe.

“If we loosen our grip on the quarantine,” the South Korean Dong-a Ilbo newspaper said in an editorial, “it could be just a matter of time for the embers of small-scale cluster infections to be revived.”

Italy reported another jump in infections Monday, up more than 3,000 to 27,980. With 2,158 deaths — including 349 more in just the last 24 hours — Italy now accounts for well over a quarter of the global death toll. Cases, however, slowed in Lombardy, the hardest-hit region.

In Spain, a cut in the frequency of commuter trains created considerable crowds during rush hour Monday Atocha, one of Madrid’s main train stations.

Wearing blue latex gloves, cleaner Mari Carmen Ramírez said she, like many others, couldn’t afford to risk her salary of $1,042 per month.

“I fear the coronavirus, but I fear more not being able to pay the utility bills,” the 55-year-old said. “When this is all over, how are we going to eat?”

Geller reported from New York. Associated Press writers Mike Corder in Amsterdam, Jovana Gec in Belgrade, Frank Jordans in Berlin, Colleen Barry in Milan, Italy, Ken Moritsugu in Beijing, Kim Tong-hyung and Hyung-jin Kim in Seoul, South Korea and Eileen Ng in Kuala Lumpur, Malaysia contributed to this report.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.