A top aide to President Mahmoud Ahmadinejad who heads Iran's official IRNA news agency, Ali Akbar Javanfekr, was arrested and jailed on Wednesday, IRNA reported. Javanfekr was detained as Ahmadinejad was delivering a speech at the annual UN General Assembly in New York, the news agency said. It said Javanfekr was taken to Tehran's Evin prison, apparently to serve a six-month sentence on charges of publishing material offensive to Islamic codes and public morality that were upheld by an appeals court in February this year. His lawyer at the time said the charges stemmed from an article in a state-run magazine under Javanfekr's control that was critical of Iranian women being compelled to wear an Islamic headscarf. Javanfekr also fought separate charges of allegedly insulting Iran's supreme leader, Ayatollah Ali Khamenei, on his personal website in April 2011. Javanfekr, who runs a state press group that prints several newspapers and magazines, is a media adviser to Ahmadinejad. He has long been targeted by hardline judges and ultra-conservative figures who see him and the president as trying to undermine religious principles they uphold. The Fars news agency reported that a statement from the Tehran prosecutor's office read: "Ali Akbar Javanfekr, who has been previously convicted on two counts, was arrested on Wednesday evening to serve his jail term. "He has been convicted of insulting the supreme leader, publishing material contrary to Islamic codes and public morality, and has also been deprived of any media activities." Javanfekr's incarceration comes days after authorities also imprisoned the son and daughter of an influential former president, Akbar Hashemi Rafsanjani, who is seen as a moderate voice in the regime isolated by hardliners. Ahmadinejad is due back in Tehran at the end of the week.