(Adds details, quotes)

LAGOS, Aug 31 (Reuters) - Nigeria, Africa’s biggest economy, officially slid into recession for the first time in more than 20 years as the statistics office announced a further contraction in the second quarter of the year.

The Nigerian Bureau of Statistics (NBS) said on Wednesday that gross domestic product (GDP) contracted by 2.06 percent after shrinking 0.36 in the first quarter.

It said the non-oil sector declined due to a weaker currency, while lower prices dragged the oil sector down.

A slump in crude prices, Nigeria’s mainstay, has hammered public finances and the naira currency, causing chronic dollar shortages. Crude sales account for around 70 percent of government revenues.

Compounding the impact of low oil prices, attacks by militants on oil and gas facilities in the southern Niger Delta hub since the start of the year has cut crude production by about 700,000 barrels per day (bpd) to 1.56 million bpd. The government’s 2016 budget assumed 2.2 million bpd.

On Wednesday, the statistics office said annual inflation reached 17.1 percent in July from 16.5 percent in June - a more than 10-year high - and food inflation rose to 15.8 percent from 15.3.

Nigeria’s sovereign dollar bonds fell across the curve to their lowest value in more than two weeks after the NBS released its data.

“The Nigerian economy contracted more deeply than we had expected in the second quarter,” said Razia Khan, chief economist, Africa at Standard Chartered bank.

“With a wider current account deficit it remains important for Nigeria to maintain a credible policy response, in order to attract much-needed stabilising inflows,” she added.

The NBS figures showed Nigeria attracted just $647.1 million of capital in the second quarter, a 76 percent fall year-on-year and 9 percent down from the first quarter.

Nigeria’s economy was last in recession, for less than a year, in 1991, NBS data shows. It also experienced a prolonged recession from 1982 until 1984.

President Muhammadu Buhari was in power for some of that period as a military ruler after seizing power in a December 1983 coup and remained head of state until the military pushed him out in August 1985.

The office of the vice president, who oversees economic policy, said in a statement it expected a “better economic outlook” for the second half of 2016 “because many of the challenges faced in the first half either no longer exist or have eased”.

Niger Delta Avengers, the group claiming responsibility for most of the attacks in the oil-producing region in the last few months, said on Monday it had ceased hostilities.

Adeyemi Dipeolu, a presidential economic advisor, attributed the recession largely to a “sharp contraction in the oil sector” caused by the militant attacks.

“The rest of the second quarter data is beginning to tell a different story. There was growth in the agricultural and solid minerals sectors,” he added.

The naira remained at the record low of 418 per dollar hit on Tuesday on the black market, as dollar shortages curb activity on the official interbank market where the currency was offered as rates as weak as 365.25 this month before gaining ground after central bank interventions. (Additional reporting by Felix Onuah in Abuja; Editing by Toby Chopra/Ruth Pitchford)