In this Oct. 28, 2010, file photo, former Brazilian President Luiz Inacio Lula da Silva shows his hands covered in oil during his visit to a Petrobras offshore ship platform for the first production oil sample from the pre-salt layer from Tupi field in Santos Bay off the coast of Rio de Janeiro, Brazil. (Felipe Dana/AP)

With just days to go before the presidential election here, a growing scandal has thrust a number of issues to center stage: They include corruption, political machinations with the state-controlled oil company, and delays and overspending on a multibillion-dollar oil refinery that Brazil needs desperately.

A high-ranking former executive from the oil company Petrobras, having turned state’s evidence, has just been released from jail to house arrest.

His allegations have appeared as a steady stream in a weekly magazine, Veja — and they link payments in the refinery construction to politicians from President Dilma Rousseff’s Workers’ Party and other parties in Brazil’s ruling coalition.

The first round of voting takes place Sunday. In a three-way race, Rousseff and Marina Silva are the front-runners, with Rousseff edging ahead, according to polls. Brazilians tend to be cynical about politicians, but the Car Wash scandal, as it is known, reaches deep into the long-standing apparatus constructed by the Workers’ Party. No one is sure where it will lead.

Rousseff, a former minister of mines and energy and former chairwoman of the Petrobras board, takes pride in her management skills. But the image of competence she has cultivated has been marred.

The Petrobras' Abreu e Lima oil refinery, in Recife, Brazil. (AFP/AFP/Getty Images)

The scandal cuts deep in another way, too. Rousseff’s strength is among Brazil’s working-class voters, but amid all the alleged overspending and mismanagement associated with the delayed refinery construction, some workers have come to feel mistreated, and they complain about not getting paid.

Rousseff’s opponents have gone on the attack.

“It’s shameful,” said Aécio Neves, the third candidate in the race, in a television debate Sunday, taking aim at Rousseff. “The denunciations don’t cease.”

Huge need for fuel

Millions of dollars were allegedly skimmed off inflated contracts for the Abreu e Lima refinery being built near Recife in Brazil’s northeast. Set to begin operating in November — three years late — its cost has ballooned.

A second Petrobras refinery project — Comperj, near Rio — is four years behind schedule, double the projected cost and delayed by strikes.

Petrobras eventually paid $1.2 billion for a third refinery in Pasadena, Tex., after a long court battle that ended in 2012, seven years after its previous owners had bought it for $42.5 million.

While Brazil’s economy stutters, Petrobras hemorrhages cash importing the fuel the country can’t refine but urgently needs. And the enormous refineries have become emblematic of the barriers Brazil faces in building much-needed infrastructure — barriers created by mismanagement, corruption and overspending.

Prosecutors say the complex Car Wash scheme was run by Paulo Roberto Costa, now under house arrest and providing testimony, and money-changer Alberto Youssef, who is in custody. Police arrested 28 people in March, having been alerted

by “irregular” movements of $4 billion. Brazil’s Federal Court of Accounts has found overpayments of $99.2 million in four contracts related to Abreu e Lima alone.

Evidence suggests “the possible involvement of various authorities . . . including federal parliamentarians,” a Supreme Court judge wrote this week in approving Costa’s state’s evidence deal.

Neves, the candidate for the Brazilian Social Democracy Party, alleges that Costa’s appointment in 2004 as a key Petrobras manager was political. “The corruption involving the company is much more serious than is being noticed,” a spokesman for Neves said in an e-mail interview.

Brazil’s rumbling economic problems — the country is in technical recession — also are a central theme of this election, and opposition candidates point to falling investment and lack of infrastructure.

“There are people who were involved in the running of the company who are involved in this corruption scandal. That does affect people who are planning to invest in the country,” said Aditya Banerjee, an analyst at Wood Mackenzie, a commercial intelligence agency in Houston.

Petrobras is keeping its distance from Costa, whose job put him in charge of refining and who was replaced in 2012. “Petrobras, in the condition of victim, is attending all the requests of the authorities and collaborating with the investigations, as the main interested party in clarifying the facts,” a company representative said in an e-mail interview.

Delays to the Abreu e Lima refinery were “principally for the need to repeat bidding because of excessive prices and delays in the acquisition of critical equipment,” the representative said without commenting on the cost increase — from $2.5 billion to $18.5 billion.

“It’s twice as much as any other refinery. Any other refinery would cost around $10 billion. So that’s massive,” Banerjee said. “It’s not just Abreu e Lima, it’s also Comperj.”

The Comperj oil refinery project, being built in Itaborai, is to start operating in 2016. Its budget has doubled to $13.2 billion. The Federal Court of Accounts has found overpayments in the tens of millions of dollars.

The delay was caused by an “unsuccessful business model of partnerships,” Petrobras said.

“In each investigation process, Petrobras is presenting its defenses and technical clarifications and has been able to demonstrate adherence of its practices to the norms and regulations in force,” a company representative said.

Comperj was paralyzed this year by a 40-day wildcat strike that turned violent. Riot police were called, a union car was set on fire and, on Feb. 6, two workers were shot and injured.

The workers were on strike because they hadn’t been paid by their employer, a subcontractor, for months. Felipe Lima, a 22-year-old carpenter, was struck by two bullets. One went through his right hand; the other burst his pancreas. Rigger Françuelio Fernandes, 20, was shot in the hand and foot.

Speaking by phone from his home state of Ceara, in Brazil’s northeast, Lima said he lives on a sickness benefit and a one-time payment of $2,000 from the construction workers’ union. Money is tight. “I can’t work,” he said. “My instrument of work is my hand.”

Petrobras did not comment on the case as a police matter.

A worrying amount of debt

Money is increasingly tight for the oil company, too. Brazil is heavily reliant on road transport but can’t refine enough fuel to meet its rising domestic demand. Petrobras has to buy gasoline and diesel abroad at high international prices, which it sells at a loss because prices are set artificially low by the government to control inflation — currently running above target at 6.6 percent. That cost Petrobras a $1.5 billion loss over the past 12 months, according to figures calculated by the Brazilian Infrastructure Center, a consulting firm in Rio.

The Brazilian Institute of Oil, Gas and Biofuels recently called for fuel prices to be freed up. “The closer to international prices, the more they make investments viable,” its president, João Carlos de Luca, said in a phone interview. “Brazil needs refining.”

Rousseff’s opponents blame fuel price policy for hurting Petrobras, the environment and Brazil’s struggling ethanol sector, underpriced by cheap gasoline and diesel.

“We have a serious problem,” said Silva, from the Brazilian Socialist Party. “This is highly prejudicial to our country and something the government needs to correct now.”

Petrobras’s ambitious development of Brazil’s ultra-deepwater reserves, central to a $220.6 billion investment program, is also at issue. Rousseff accused Silva, an environmentalist, of being anti-oil.

The enormous cost of developing those reserves, combined with the losses incurred importing fuel, has put Petrobras in a worrying amount of debt — $114 billion at the end of 2013, according to Bloomberg.

But Petrobras is increasing production from those deep­water reserves. It promises to produce 4 million barrels of oil a day, compared with the current 2.6 million.

“Until then,” said Ruaraidh Montgomery, a senior analyst at Wood Mackenzie, “we see things being pretty tight financially,”