A leading university has apologised to two students who were threatened with expulsion from a freshers' fair if they failed to cover T-shirts depicting a cartoon of the Prophet Mohamed and Jesus Christ.

Christian Moos and Abhishek Phadnis say they were "harassed" by security officials for wearing the T-shirts and told displaying a depiction of Mohamed - prohibited under Islamic law - could constitute harassment of a religious group.

The incident happened when they were representing the London School of Economics' students' union's Atheist, Secularist and Humanist Society at the fair.

Now the LSE says its director, Professor Craig Colhoun, has apologised for their treatment, adding:  "With hindsight, the wearing of the T-shirts on this occasion did not amount to harassment or contravene the law or LSE policies."

He told the students: "Members of staff acted in good faith and sought to manage the competing interests of complaining students and yourselves in a way that they considered to be in the best interests of all parties on the days in question."

In a statement, the two students said - whilst they welcomed Professor Calhoun - they were "disappointed" it had taken the threat of legal action to secure it and that no apology had come from the LSE students' union - which had originally approached them over the T-shirts - or from Professor Colhoun over the behaviour of security staff.

The students had been planning to take the incident to a judicial review in the High Court.

Their statement noted that the LSE had been unable to produce any evidence of complaints about the T-shirts, adding:  "We continue to believe that there were, in fact, none."

The LSE's apology comes at a time of rising controversy over freedom of speech on university campus which saw Universities UK, the body which represents vice-chancellor, withdraw controversial guidance which suggested it was all right to segregate men and women at meetings if an outside speaker demanded it,

The statement from the two students on the Students' Rights website said of the incident: "This is no way for a university to maintain its duty to protect freedom of expression on campus."

LSE pro-director Professor Paul Kelly told the BBC Radio Four programme Today that the university had been attempting to balance the rights of different students in a dispute but had "got the judgement wrong".

"In general, our attitude is very tough in promoting free speech at public events, lectures and student societies.

"This was a complex event because it's a welcome event.  It's when students from 130 countries arrive in the UK all together.  Freedom of speech still applies there but it wasn't the same as us objecting to a student society event or a public lecture or if Christian - as he later did - hosted an event where students wore the T-shirt.  That's fine.

"Given the complaint that Christian and Abhishek put forward with the backing of solicitors looking for judicial review, we had to taker legal advice.  It was always a grey area.  Yes, I got the judgement wrong but it was a complex decision."

Mr Moos said:  "It was simply two students exercising their right to freedom of expression that they have as much as any student who might wear religious symbols or T-shirts expressing their faith.

"If somebody was wearing a racist or violent or gory T-shirt, that would be a totally different situation."

At the fair, the two students covered up their T-shirts to avoid expulsion.