The ex-general who lost Indonesia's closely-fought presidential election will challenge the result in the Constitutional Court, a spokesman said Wednesday, after his team alleged that the winner Joko Widodo engaged in massive vote fraud.

"We are in the process of preparing our challenge to the Constitutional Court," said Tantowi Yahya, a spokesman for the campaign team of Prabowo Subianto.

The move was a surprise after Prabowo angrily announced he was withdrawing from the race Tuesday just hours before the result was announced, and members of his campaign team indicated he would not mount a legal challenge.

It will prolong the political uncertainty for several more weeks since the court will not issue a ruling until late August.

Official election results showed that Widodo, known by his nickname Jokowi, won a convincing victory in the July 9 election, beating Prabowo by 53 percent to 47 percent.