LONDON — The official numbers were published Wednesday, and they are officially ugly. The British economy has plunged into a record-shattering recession, shrinking by a fifth in the second quarter and posting the steepest decline of any Group of Seven nation.

Alongside huge job losses announced a day earlier, Prime Minister Boris Johnson’s Britain now finds itself with the worst economy and highest number of excess deaths from the novel coronavirus in Europe.

The official data released Wednesday by the Office for National Statistics (ONS) showed that gross domestic product (GDP) fell 20.4 percent in the second quarter — April, May and June — compared with the first quarter. The downturn reflected losses across all sectors, after the country went into a tight lockdown in the third week of March.

“The recession brought on by the coronavirus pandemic has led to the biggest fall in quarterly GDP on record,” said Jonathan Athow, ONS deputy national statistician.

A recession is called when two consecutive quarters show contraction in GDP. Britain’s first quarter in January, February and March was down 2.2 percent. This is Britain’s first recession in 11 years, since the global downturn in 2009.

Chancellor of the Exchequer Rishi Sunak, who serves as Britain’s finance minister, said the government was “grappling with something that is unprecedented.”

He told reporters: “A few months ago, I said that hard times were coming. Today’s figures show that hard times are here.”

Sunak warned of further job losses, even without a second wave of coronavirus infections. A government program that was paying up to 80 percent of a furloughed worker’s salary is set to expire in October. Sunak said continued high-level government job support was not sustainable.

“We’ve already got the worst excess death rate in Europe — now we’re on course for the worst recession too,” tweeted Anneliese Dodds, the opposition Labour Party’s point person on the economy.

“That’s a tragedy for our country, and it’s happening on the PM’s watch,” she said.

In the new numbers, April proved the cruelest month. It showed the sharpest contraction, with shops and restaurants shuttered, factories idled, construction at a near standstill and domestic and international travel curtailed.

In one bit of hopeful news, the British economy began to bounce back in June. Output was up 8.7 percent month on month, as shops reopened, factories began to ramp up production and house-building continued to recover. Even so, GDP in June was far below the level of production in February before the virus struck, the ONS reported.

By comparison, the U.S. economy shrank by 9.5 percent over that same period, and the euro zone, made up of European Union countries that have adopted the euro currency, contracted by 12.1 percent.

Despite the recession, Johnson is pressing ahead with his vow to pull Britain out of the E.U. at the end of the year — with or without a trade deal. A pact with the bloc, Britain’s closest trade partner, has proved elusive, with the sides still far apart as talks drag on.

The fact that Britain is in a recession does not come as a surprise, since much of the economy was in lockdown during the second quarter of 2020. Britain was slower than many E.U. countries to go into lockdown and slower to come out. In mid-March, bars, restaurants and other “nonessential shops” were closed, and the government did not start lifting restrictions until June.

Anand Menon, professor of European politics at King’s College London, said the figures that many will be watching for are not those from the second quarter of this year, when Britain’s economy was largely frozen, but from the third quarter, which will show “how effective the government’s measures are to get the economy back post lockdown.”

“The third quarter will give us the first indication as to whether you are talking a V or a W or an L or whatever the letter of the alphabet,” he said, referring to the various shapes of rebounds that the economy could take, as shown on a graph.

Johnson’s government is paying the wages of more than 9 million people under its furlough plan. It will start winding that up in October, prompting fears of an unemployment spike in the fall.

There is a debate in Britain over whether furloughs should be extended for some sectors and what kind of funding the government might provide for those whose jobs will be lost. This week, official statistics showed that employment has already suffered its biggest decline in more than a decade.

The government has also introduced initiatives such as “Eat Out to Help Out,” which offers customers 50 percent discounts at restaurants and pubs between Monday and Wednesday in August.

Johnson told reporters this week that the economy faces “bumpy months” and has a “long, long way to go” until it recovers. The Bank of England forecasts that the British economy will not return to pre-pandemic levels until the end of 2021.

“The figures are quite devastating, but anyone who was paying attention would have expected quite devastating figures,” said Isabel Stockton, a research economist at the Institute for Fiscal Studies, an independent economic research organization.

Stockton said that Britain was expected to be hit hard in the second quarter in part because of the timing of its lockdown — and because its economy relies heavily on hard-hit sectors. About 80 percent of it flows from services, and many businesses in retail, accommodation, tourism, food and entertainment were temporarily shut during the lockdown.

Stockton agreed that the next set of figures will be the ones to watch, as they indicate the kind of recovery the economy might have.

“For the labor market, for the public finances, it matters a lot how quickly we recover, possibly more than how far we crash,” she said.

Of course, a second wave triggering a second lockdown, or even just reduced confidence, could further hammer the economy.

“Even if we are not in lockdown, if cases rise and people are very concerned about going out, then understandably the rebound could be frozen relatively quickly,” Stockton said.