Former Ecuadorian president Lucio Gutierrez has been released from prison after a judge cleared him of charges of endangering national security.

The judge announced the release Friday in a courtroom in Quito, Ecuador's capital. In response, Mr. Gutierrez said he wanted to "thank God and the Ecuadorian people".

Ecuador's lawmakers voted Mr. Gutierrez out of office in April last year, after he made substantial changes to the Supreme Court and later disbanded it altogether. He was arrested in October for saying his ouster was illegal.  The judge Friday found that making that statement did not break any laws.

Vice President Alfredo Palacio replaced him as president and remains in office. Mr. Gutierrez has vowed to run for the presidency again in October elections. But he has very little (less than 10 percent) voter support

Some information for this report was provided by AP and Reuters.