Vietnam's prime minister has stepped down after 10 years in office, leaving behind a mixed legacy of promoting failed state enterprises, but at the same time attracting foreign investment and daring to challenge China.

In a formal vote on Wednesday, 418 members representing 84 percent of the rubber-stamp National Assembly "agreed to dismiss" Nguyen Tan Dung from his duties, three months before the end of his term, the government said on its website.

The National Assembly is scheduled to elect Dung's deputy, Nguyen Xuan Phuc, as prime minister on Thursday.

Dung's departure was a mere formality after he lost a leadership battle during the ruling Communist Party's congress in January.

During that vote, Dung lost to Nguyen Phu Trong, who was re-elected party general secretary for a second five-year term.

In Vietnam, the Communist Party general secretary, the prime minister, and the president form the triumvirate of power.

Dung was easily the most high-profile prime minister Vietnam ever had. He was charismatic, a good orator, and mixed easily with foreign leaders, which raised the country's profile.

But within the party he was blamed for the failures of huge state-owned enterprises, including the monumental collapse of the Vietnam Shipbuilding Industry Group and Vietnam Shipping Lines. Many of the state-owned enterprises ended up with mountains of public debt.

Dung's policy initiatives "drew criticisms from both conservative and reform elements within the party", Jonathan London, a Vietnam analyst at the City University of Hong Kong, said in an email interview.

Also, Dung's closeness with numerous newly and unusually wealthy Vietnamese raised suspicions among many.

Dung took office in 2006 as the global financial crises set in, followed by a global economic slowdown that severely affected Vietnam.

Dung won accolades from the Vietnamese people for standing up to China in territorial disputes in the South China Sea.