A 32-year-old former German spy has gone on trial on allegations he sold classified information to the CIA and also offered it to the Russians.

Markus R., whose last name wasn't given, in line with privacy laws, is accused of treason, violating Germany's official secrets regulations and corruption.

As his Munich state court trial opened Monday he confessed to spying for the CIA, saying he acted out of frustration and boredom, the dpa news agency reported.

He's accused of passing classified material to the CIA between 2008 and 2014 for payment of 95,000 euros ($102,000), reportedly including lists of German agents working abroad and their aliases.

Shortly before his 2014 arrest he also offered Russian intelligence services information.

He faces up to life in prison if convicted.