BUENOS AIRES — The leadership of Petrobras, the Brazilian national oil giant grappling with a sprawling graft scandal, abruptly resigned on Wednesday amid accusations of a bribery scheme involving kickbacks to President Dilma Rousseff’s governing Workers Party and its allies.

The shake-up included the departure of Maria das Graças Foster, the chief executive handpicked in 2012 by Ms. Rousseff, after months of tumult at the state-controlled oil company. Skepticism had grown over Ms. Foster’s capacity to deal with the scandal at a time when low oil prices are also forcing the company to slash spending on costly projects.

Ms. Rousseff had recently decided to replace Ms. Foster and other senior executives this month, according to news reports, fueling a surge in Petrobras shares. The newspaper O Globo reported on Wednesday that Ms. Foster insisted on resigning after meeting on Tuesday with the president in Brasília.

Reflecting a low point for Ms. Rousseff, who narrowly won re-election in October after a bitter campaign marked by attacks on her management of Petrobras and of Brazil’s sluggish economy, even some within her own party said she had been too slow to make changes at the oil company.