SEOUL (Yonhap) — Overturning a lower court ruling, a Seoul appellate court on Monday sentenced a former head of the state intelligence agency to three years in jail for intervening in the 2012 presidential election.

The Seoul High Court said Won Sei-hoon, who headed the National Intelligence Service (NIS) from 2009 to 2013, “willfully neglected” an online smear campaign carried out by his subordinates against the rival candidates of President Park Geun-hye, the then ruling party hopeful.

“It is fair to say Won had the intention to intervene in the election even by willfully neglecting these activities,” Judge Kim Sang-hwan said in the ruling.

Won was immediately taken into custody by court officials.

Last September, a Seoul district court cleared the 64-year-old Won of election meddling while holding him accountable for “intervening in politics.” The opposition parties called the ruling “nonsensical.”

He was given a prison term of two and a half years with a four-year stay of execution, against prosecutors’ wish to imprison him for four years.

Won’s subordinates were found guilty of posting some 780,000 messages on online bulletin board and social media, including re-tweets on Twitter, in the run-up to the election.

Prosecutors said these comments were posted to sway the public opinion in favor of Park, in violation of the law that bans public officials from engaging in election campaign activities.

Park won the election, edging out her biggest rival by only a slight margin of 3.5 percentage points.