Elmer, 55, among the first to use WikiLeaks to publish private bank documents, said he took his information to the website after Swiss authorities failed to act on it.
"The ethics of business leadership on both sides of the Atlantic have disappointed me," he said, adding that he wanted to expose illegal offshore activity in the Cayman Islands.
Elmer said Baer waged a campaign of "psychoterror" against him and his family and offered him 500,000 Swiss francs (£325,000) to keep quiet. He said he had never taken payments in return for secret data.
But he admitted writing anonymous emails in 2005 threatening to send client details to tax authorities and the media if Julius Baer did not stop unspecified actions against employees.
"The situation was very threatening. We were very scared and I thought the bank was behind it. That is why I sent the emails," Elmer told the court.
Wearing a black suit and a red shirt, Elmer also admitted charges that he sent details of tax evasion to Swiss tax authorities, but he denied he made a bomb threat against the Zurich headquarters of his former employer, Julius Baer, threatened a Baer employee and tried to blackmail the bank.
Prosecutor Alexandra Bergmann said the reason Elmer denied those charges was because they contradicted a defence strategy that he acted out of altruistic and public interest motives.
Elmer's lawyer Ganden Tethong Blattner said her client and his family had paid for standing up to a powerful opponent.
"This is the story of a man who discovered misdeeds and was under constant surveillance for more than a year. This great pressure was aimed at silencing him," she said.
Tethong Blattner accused Swiss prosecutors of uncritically adopting evidence provided by Julius Baer's private investigators without doing their own investigations.
Julius Baer says Elmer waged a "campaign of personal intimidation and vendetta" against the bank after it refused his demands for financial compensation following his 2002 dismissal.
Prosecutors are asking for Elmer, who ran Baer's office in the Cayman Islands until he was fired in 2002, to be sentenced to an eight-month jail term and to pay a 2,000 franc fine. A verdict is expected later today.
Wednesday's case does not concern his publication of bank data on WikiLeaks, but earlier alleged breaches of bank and corporate secrecy in Switzerland and threats against Baer.