A former German intelligence agent who was also once an actor in gay pornography has been given a one-year suspended sentence for attempting to share state secrets while pretending to be a jihadist online.

The 52-year-old, named as Roque M, was arrested last November in what initially appeared to be a case of an Islamist mole at work in Germany’s domestic spy agency.

He was freed in July after prosecutors dropped most of the charges, finding no evidence of an attack plot or ties to Islamist groups.

He told the court he pretended to be a jihadist planning an attack in online chatrooms because he was bored. “I never met with any Islamists. I would never do that. The whole thing was like a game,” he said at the start of his trial in the western city of Düsseldorf.

A former banker and a father of four, Roque M told the court he monitored the Islamist scene as part of his job for the Office for the Protection of the Constitution (BfV), a role he described as “a lot of fun”.

He said he grew bored at weekends when he was at home with his disabled son, and immersed himself in the online world of Islamists, pretending to be one himself.

It was “an escape from reality”, he said in court.

He went as far as arranging a meeting with a suspected Islamist at a gym, although Roque M insisted he never had any intention of going.

He was caught when he offered to share classified information about BfV operations with someone who turned out to be a colleague working undercover.

The case initially sparked outrage, with Germany’s domestic spy agency fending off calls for a complete security overhaul for allowing an “Islamist” to infiltrate its team, who had passed multiple screenings.

The intelligence agent’s past as an actor in gay pornography also caught the public’s attention.

As no evidence emerged of an actual Islamist plot, prosecutors left Roque M facing the sole charge of attempting to share state secrets.