Image copyright AFP Image caption Won Sei-hoon (centre) said he only ever worked for his country's safety

South Korea's former spy chief has been sentenced to three years in jail for trying to influence the results of the 2012 presidential election.

Won Sei-hoon, who headed the National Intelligence Service (NIS) until 2013, was found guilty of violating election laws.

He was convicted of directing NIS agents to conduct an online smear campaign against the rivals of current President, Park Guen-hye.

Won was immediately taken into custody.

Under South Korean law, NIS agents are required to remain politically neutral.

Won ordered NIS agents to post messages and tweets online in support of Ms Park, who went on to narrowly win the election in 2012.

Some of the messages also ridiculed her rivals, saying they were "servants" of North Korea.

'Serious crime'

In September, a district court found Won guilty of violating the laws that say NIS agents should not be involved in politics but gave him a suspended sentence of two-and-a-half years in prison, saying there was not enough proof that he had directly sought to influence the results of the election.

However, on Monday the Seoul High Court dismissed the lower court's decision and said he had also violated election laws.

"It is fair to say Won had the intention to intervene in the election," Judge Kim Sang-hwan said, according to Yonhap news agency.

Just before he was taken into custody, Won insisted he had only ever worked "for the safety of my country and its people", Yonhap said.

Over its history, the NIS has repeatedly been accused of meddling in domestic politics and being a political tool for sitting presidents.

It was created to spy on North Korea, which is technically still at war with the South.