The Bavarian state court rejected the ex-agent's claim for €400,000, ordering him to also pay court costs and denying him the right to appeal.
The man had once been the head of the Bundesnachrichtendienst's (BND) office in Riga, the capital of Latvia. But he started an affair with a Latvian woman despite knowing it is BND policy that agents are forbidden from becoming sexually intimate with citizens of the country in which they work.
He also didn't initially inform the BND of the affair, but let his counterparts at the Latvian secret service check on her background.
By the time he had told his employer of the relationship, she had already moved in with him.
At the same time he informed his seniors that one of his staff had also been having a relationship with a Latvian woman, who had similarly been evaluated as harmless by Latvian intelligence.
The BND hierarchy weren't happy though, and recalled the spook in 2008, before deciding he was no longer fit to work for the service.
In an initial hearing, the court had acceded to some of the man's claims after an administrative court found the BND to have contravened his rights.
The man's lawyer has now said he will ask the federal court to annul the ruling.