District Magistrate Guarav Dayal said that the affidavit submitted by 29-year-old Varun stated that his actions were not in violation of Constitution and he has obeyed the law.
The BJP candidate, who moved the Supreme Court seeking relief to allow him to contest the Lok Sabha elections from Pilibhit, promised not to give provocative speeches that would violate the Constitution or lead to any law and order problem, Dayal said, adding the affidavit will now be sent to the Supreme Court.
The Uttar Pradesh government on Monday accepted the Supreme Court's suggestion on the undertaking by Varun after the apex court described the detention under the stringent act as a "drastic step."
The court had said Varun's plea for bail could be accepted only if he comes out with a promise that he will not make provocative speeches during his campaign.
Varun was detained under NSA on March 28 on charges of inciting communal passion by making provocative speeches during election meetings in Pilibhit on March 7 and 8.
He was lodged in the district jail in Pilibhit and later moved to Etah prison for security reasons.
The filing of nomination papers for Pilibhit starts from April 17.
Varun Gandhi's 'silent' adversary
Varun to promise SC he won't be reckless
India Votes 2009