A high court rules the home secretary, Theresa May, to reconsider the deportation order 'in accordance with the law'. Photograph: Rex

A decision to deport a former serving British soldier to Botswana because of a speeding conviction was legally flawed, the high court ruled on Tuesday, ordering the home secretary, Theresa May, to reconsider her decision in accordance with the law.

Sapper Poloko Hiri, 33, who served four years with the British armed forces and who remains in the reserves, had his application for citizenship refused by the UK Border Agency. The agency claimed the sole speeding offence, for which he received five points and a £100 fine, was evidence of bad character.

Hiri was convicted after being filmed on a traffic camera in 2011 travelling at 81mph in an area where there was a temporary 50mph speed limit. He was driving on the M1 near Swinford, Leicestershire, at 1.21am after leaving Ripon barracks, North Yorkshire, to begin Easter leave.

He said he feared prosecution and lengthy imprisonment in Botswana under the foreign enlistment act, which makes it a criminal offence to act in the military service of another country. He applied for naturalisation in the UK in February 2012, the high court heard.

His commanding officer, Major Chloe Plimmer, described Hiri as an intelligent, motivated and hard-working soldier with an exemplary record of conduct, who "had his character put to the test … where his peers have had to depend on him in austere and challenging environments".

The Home Office refused his application, citing the speeding offence.

Hiri, who has an 18-month-old daughter in Britain with his former girlfriend, served as a military draughtsman with 21 Engineer Regiment. He gave 12 months' notice to leave the army in 2011 to study for a degree in architectural technology at London South Bank University. He sought a judicial review of the decision by the home secretary.

The judge, Mrs Justice Lang, said that the decision in May 2012 by a UK Border Agency official indicated that the assessment of Hiri's character was based entirely upon the fact that Hiri had an unspent conviction; there was no reference to any other aspect of his character and background.

"This was not an adequate assessment of the claimant's character, as required by law. No references were sought from his employer, or his personal referees, and there was no interview with the claimant."

The judge held that the home secretary "must consider all aspects of the applicant's character" where "the statutory test is not whether applicants have previous criminal convictions – it is much wider in scope than that".

Hiri had repeatedly made clear he took full responsibility for the offence, and accepted it had to be taken into account, but asked for that conviction to be weighed in the balance against all of the evidence he had provided for an assessment of his character, the court heard.

The judge ruled that the home secretary was "entitled to adopt a policy on the way in which criminal convictions will normally be considered by her caseworkers, but it should not be applied mechanistically and inflexibly".

She added: "There has to be a comprehensive assessment of each applicant's character, as an individual, which involves an exercise in judgment, not just ticking boxes on a form."

Hiri's solicitor, Toufique Hossain, said his client had served this country, and had shown good character in every other way apart from one speeding offence. "It is a shame this had to go all the way to the high court. The home secretary should have seen sense long ago instead of fighting this case."

Wing Commander Hugh Milroy, chief executive officer of Veterans Aid, which campaigned on Hiri's behalf, told the court: "Poloko served without any blemish whatsoever. If Poloko was good enough to carry a weapon for this country, then surely he is good enough to be a citizen."

After the judgment, Hiri said: "I am just glad this is over. It should have never seen a day in court. I still feel like an absolute idiot even though my speeding was more of an honest misjudgment of circumstances that anything else. It is perfectly fine for the government to rid the country of undesirable characters and no reasonable person would have any reservations on that. But for the Home Office to bracket a single speeding offence with terrorists, murderers etc is unfair. Maybe the Treasury Solicitor should advise the Home office a bit more stringently against being adamant in respect of cases of this nature."