RIO DE JANEIRO, May 15 (Xinhua) -- Former Brazilian President Michel Temer was released from preventive arrest on Wednesday and will await trial for corruption in freedom.

Temer turned himself to the police last week amid an investigation into corruption and was kept at the headquarters of the Military Police of Sao Paulo State.

The preventive arrest aimed to ensure that the former president would not escape or interfere with justice.

On Tuesday, the Sixth Panel of Brazil's Superior Court of Justice (STJ) granted him temporary release after Temer and others being charged presented an appeal.

The STJ ruled that there was no evidence of ongoing illegal activities and that the pretrial detainment was not justified.

The former president is accused of heading a several-year-long corruption scheme related to the construction of nuclear power plant Angra 3 in Angra dos Reis, Rio de Janeiro state.

Though released, Temer has to follow some rules: he must surrender his passport to the authorities, and cannot change his addresses, leave the country, or contact other accused people in the same investigation process.