In may, madrid sought to break free from the nightmare of covid-19. death rates and infections had fallen since the days when the spanish capitals international exhibition centre had been converted into a 1,000-bed intensive care unit and an ice rink into a morgue, but economic life lagged far behind.

The greater madrid region sued the national government to relax lockdown measures undeterred by the resignation of its director of public health in protest at the drive to open up. if madrid does not get going again, we will be destroying thousands of businesses, thousands of jobs, ignacio aguado, the deputy head of the regional government, said shortly before the lawsuit.

Within a month, the madrid region, of 6.6m people, had broken completely out of the lockdown and the emergency powers wielded by spains national government over the regions had lapsed. plans to lift restrictions in phases according to criteria such as health resources and infections were effectively abandoned.

Almost 6,000km away in new york city which endured long weeks as the viruss epicentre in the us, just as madrid had been in europe a decision was taken to proceed much more slowly. it was a fateful parting of the ways for the two cities.

Madrid is faring far worse than new york for new infections. maps showing new cases per 100,000 people in the last 14 days for madrid and new york city

Today madrid is once again the worst hit region in europe. over the past week almost a quarter of the people it has tested for coronavirus have been positive; in new york city, the figure has been below 2 per cent since june the past seven days, there have been 331 infections per 100,000 of the population in madrid; in new york state the equivalent figure is 25.2.

The story of how madrid and new york diverged is a tale of the grim consequences of mistakes made, particularly over phasing out the lockdown measures; of tensions between economic considerations and health; and of the emerging reality of a second coronavirus wave crashing over europe. that now threatens the likes of france and the uk which have both seen a marked rise in cases.

The differences may be best encapsulated by how madrid and new york dealt with their restaurants. under andrew cuomo, new york governor, the state has been stubborn about lifting restrictions on indoor dining a policy that has suppressed the virus but at a huge cost to businesses. a survey by the nyc hospitality alliance found that nearly 90 per cent of restaurants and bars could not pay their full rent in august, and said many had been financially devastated".

Miguel hernn, an epidemiologist at harvard university who advised the spanish government on phasing out the lockdown, says madrid has failed where new york has succeeded: by opening bars and restaurants too fast, not having enough people on hand to track and trace the progress of the disease, and not carrying out enough tests to map its full extent.

In recent days an increasingly desperate madrid government imposed new restrictions on 850,000 people in the areas worst affected by the virus mainly poor southern districts of the city where inhabitants will be prohibited from entering and exiting without due cause.

Chart showing that new hospital admissions and deaths are surging again in madrid, but not in new york city

Epidemiologists fear such steps will be insufficient to curb rampant infection rates particularly because children have now returned to school after six months away, colder weather is pushing people indoors where the disease spreads more easily, and spaniards are still socialising and visiting bars and restaurants, where the risk of infection is greater.

A key driver of decisions should be the occupancy of critical care beds and its hard to see how these measures will help avoid the saturation of hospitals, says prof hernn. the thing to guard against is the health system collapsing again...we need a plan.

Madrids government says that covid-19 patients now take up about 40 per cent of icu beds in the region twice the level of the start of this month. many doctors say the true level is much higher and that some emergency wards are already effectively full.

For madrid, some of the policies that could have made a difference in managing the disease in recent months such as an efficient tracing system as countries such as germany appear to have deployed may now be unable to cope with the rapid rise in cases. instead more broad brush measures, such as lockdowns, could be the only way out.

In june we tried to return to a certain normality with this drive to reopen the economy, with a false sense that the virus had been defeated, says pedro alonso, a professor of global health at barcelona university who heads the whos malaria programme. we didnt make sufficient preparations and that is a large part of the reason why we have this second wave.

Chart showing that covid-19 cases now take up almost all of madrids dedicated icu beds

Given the importance of bars and restaurants to the spanish economy hospitality represents 6 per cent of gross domestic product and tourism 12 per cent much of the restart consisted of opening places to eat and drink. on june 8 the region said it would reopen the interiors of bars and restaurants. the madrid hospitality association which says the sector in the region has lost 40,000 jobs this year declared itself very satisfied.

The impact of such measures is still not clear. without better data on who visits bars and restaurants in spain, as in many other countries, customers do not have to fill out contact information it can be very difficult to quantify the risk of eating or drinking in a public place. but a recent study of outpatients of healthcare facilities by the us centers for disease control and prevention suggested that people who are infected are twice as likely to have eaten at a restaurant as those who test negative.

The spanish health ministry congratulated itself on having completed a swift, safe phase-out from lockdown, which had become increasingly politically poisonous, with regions and opposition parties calling to regain the right to manage their own affairs.

The public responded. footfall figures show a much more dramatic madrileo return to bars and restaurants very much greater than new york city, but also considerably larger than rome, italys capital, which has not suffered the same kind of covid resurgence as its spanish counterpart.

Within two weeks of the end of the lockdown, cases began to go up in spain. its what happens when you relax restrictions, says prof hernan. it can go fast or slow, but the key thing is to keep track and detect big changes in time.

Spains 17 autonomous regions each with a medical system of its own created further complications, particularly for compiling reliable national data from figures that were frequently late or based on different criteria.

Commitments that regions entered into as part of the lifting of restrictions sometimes went unmet. in may, madrid promised to hire 400 track and trace workers; in july the figure was still 182 one for every 36,000 inhabitants. today the number is around 1,000.

We are going to have 1,500 track and tracers in madrid, isabel daz ayuso, head of the regional government, said this week. but with the current figures for madrid, for track and trace to be efficient, we would need to track millions [of contacts] all the time.

Similarly, although madrid performs roughly 20,000 diagnostic tests a day and is planning to carry out 1m rapid antigen tests which identify proteins that make up the virus this week, the sheer scale of contagion makes it difficult to keep up. the high proportion of positive results in the region 23 per cent of all tests carried out indicates that a significant number of cases are going undiagnosed.

Ms daz ayuso opposes any new regional lockdown, saying it will be death to our community. but others in her administration say it cannot be ruled out and the spanish government has already called on madrileos to limit their mobility to the utmost.

New yorks story has been very different. in june case numbers were steadily dropping. under a phased reopening plan set out by mr cuomo and mr de blasio, restaurateurs in the city were optimistic they would qualify to offer indoor dining by the july 4 holiday.

Then state health officials noticed something in the reams of data they collect each day: bars and restaurants in upstate new york, which had already been allowed to reopen, were triggering upticks in infections.

Mr cuomo postponed the resumption of indoor dining, and did not say when he might reconsider his decision. it contributed to the staggering losses of new york citys restaurants, many of which have been put out of business by the pandemic.

Yet it also explains how new york has managed not only to contain the virus but to keep it suppressed while other cities in the us which has suffered more than 200,000 deaths and many in europe, are seeing it roar back to life.

Certainly, the governor and [new york city] mayor [bill de blasio] have erred in the direction of favouring the health over the economic side of the crisis, says kathryn wylde, president of the partnership for new york city, a group of business and civic leaders.

Ms wylde describes their approach as obdurate but effective. new york city is on track to lose more than 600,000 jobs this year, and is facing a $9bn fiscal deficit. the state has paid as much money in unemployment benefits in the past six months $43.7bn as it has in the previous 20 years.

Chart showing that madrid came out of lockdown much more rapidly than new york

Mr cuomos team says it has followed the data, ignoring president donald trumps tweets to liberate the citys economy and critical newspaper editorials. from a slow start, the state now conducts more than 90,000 tests a day, keeping to a phased reopening plan in which each of the states 10 regions had to satisfy seven metrics before they could begin to resume activity.

These included declining death and infection rates over a sustained period of days and minimum hospital capacity. if the numbers ticked up, then the reopening would be paused, or even reversed.

New york public health officials have made adjustments along the way. when they discovered, for example, that infections were surging in other parts of the country they instituted a quarantine for many out-of-state travellers arizona, minnesota, nevada, rhode island and wyoming were added to the list this week even though that has piled further damage on the citys moribund tourism and services industries.

When neighbouring new jersey announced in late august that it would resume indoor dining, mr cuomo initially shrugged. but days later, he finally relented and announced that city restaurants would be allowed to offer indoor dining from september 30 but at no more than 25 per cent capacity.

The city's business leaders may not be happy. but, says ms wylde, realise that the worst outcome of all would be to reopen and have to shut down again.

Spains national and regional authorities admit they are in a full-blown second wave. it is less lethal, less fast, pedro snchez, prime minister, said this week, but still very dangerous.

Yet some epidemiologists cast doubt on whether the second wave is so different from the first. the spanish government acknowledges that in march and april it detected fewer than 10 per cent of cases principally people who were gravely ill and hospitalised. that means, by definition, that official statistics failed to capture the demographic make-up of the remaining 90-plus per cent. such a gap in the data appears to undermine the governments insistence that the virus is now on average infecting much younger people who are at less risk of death than in the first wave.

The lethality rate for spain as a whole the proportion infected by coronavirus who ultimately die has more than doubled in september from 0.4 per cent to 0.9 per cent.

Ms daz ayuso, who has been criticised for blaming the diseases resurgence on immigrants way of life in poor working class districts, argues that madrid has been particularly badly hit because of its population density, and its role as a transport and business hub and that it cannot be compared with any other region in spain.

But mr snchez has noted that the rate of infection in madrid is more than double the average in spain as a whole, as is the rate of occupancy of intensive care beds in the region.

The region remains crucial not just for the whole of spain, but also a possible indicator of france and the uk, two of the other countries contending with big rises in cases. on tuesday the british government announced another raft of measures, including forcing pubs and restaurants to close at 10pm and greater use of face masks, as it too sought to stave off wider lockdowns.

The madrid government is still reluctant to close down the hospitality industry. its most recent measures shut public parks in the most infected parts of the city, but they allow bars and restaurants in those zones to stay open albeit at half capacity and with an obligatory closing time of 10pm.

Many epidemiologists fear the worst. we still dont have reliable data in real time to help manage the crisis, the phase-out of the lockdown wasnt done with the correct attention to detail...and our track and trace capacity is clearly not enough, says prof alonso. we took short-cuts and we are paying for them.

There is no guarantee new york city's calm will last. one of mr de blasio's top health officials warned on wednesday that lockdown measures could be reimposed after the city discovered rising infections in some brooklyn neighbourhoods. meanwhile, the city's school system, the nation's largest, is in the midst of a fitful return to class that could eventually throw hundreds of thousands of children together and create new risks of transmission.

But for now the us city is in a far better place than madrid. the situation in madrid is clearly uncontrolled, says prof alonso. treatment has improved somewhat; care homes have been protected. perhaps it wont be as terrible as it was in march. but a reasonable assumption is that these large-scale infections will lead to a large-scale increase in serious cases and ultimately to a large-scale increase in deaths.