The number of emergency rooms has dropped by more than a quarter over the past two decades, while patient visits have kept rising, researchers said Tuesday.

The result is overcrowded ERs that can't provide optimal care for their patients, according to the new findings, published in the Journal of the American Medical Association.

"This is a continuously deteriorating situation," said Dr. Renee Hsia, an emergency physician at the University of California, San Francisco, who worked on the study. "It's a threat to everyone's care."

In the first study of its kind, Hsia and her colleagues used data from the American Hospital Association to track which hospitals closed or opened ERs across the nation.

From 1990 through 2009, they saw a drop from 2,446 to 1,779 urban ERs, corresponding to 27 percent.

"That's a huge number," Hsia told Reuters Health. "When you look at ER visits over the same time period, there was a 35-percent increase."

ERs are the only part of the U.S. healthcare system required to treat all patients, regardless of whether they can pay. But hospitals aren't required to have an ER, Hsia said, so that is a natural place to look for savings when the economy is tight.

Linking the ER closures to individual hospitals' financial information and their patient mix, the researchers found that several factors were tied to ER closure.

For instance, for-profit hospitals were more like to shut down their ERs, compared to non-profit and government hospitals. The data showed that 26 percent of the closed ERs were at for-profit hospitals, compared to only 16 percent of those than stayed open. Hospitals that closed their ERs were also more likely to have low profit margins.

ERs that were shut down also tended to be located in highly competitive markets and serve a higher proportion of poor people.

"This shows that the market forces very much are at play in our healthcare system," said Hsia. "My opinion is that when we rely on a market-based approach, we can't expect resources to be distributed in an equitable fashion."

With a rising demand and a diminishing supply, the remaining ERs become increasingly crowded, producing nationwide repercussions.

"There are very good studies to show that crowding definitely does affect how well people do," said Hsia. "When we leave things up to the market these are the effects that we see."

However, fixing the problem is much harder than spotting it. Hsia said the situation is approaching an emergency and calls for bold policy changes.

"Some of the issues this raises is how do we pay for healthcare and especially emergency care, because that's a service that our country has decided we want to pay for," she told Reuters Health.