Academic freedom has been put in the spotlight with two universities recently coming down hard on academics for comments on social media.

Martin Hirst, a lecturer in journalism, was suspended earlier this year from Australia’s Deakin University for making provocative and obscene comments on Twitter. The university acted after conservative columnist Andrew Bolt drew attention to these tweets in his newspaper column.

Hirst was reinstated after a letter of protest from 150 Deakin academics. To settle the case against him he apologised for using “inappropriate and offensive language”.

Last month University of Illinois trustees blocked the appointment of Steven Salaita to a professorship in American Indian Studies. His offence was to tweet comments about Israel and its leaders that many people found unacceptable.

Some departments at the university responded by condemning the decision. Academics elsewhere are boycotting the university by refusing to accept invitations to talk on its campuses.

According to one departmental letter of protest, the board’s decision demonstrated a clear disregard for the principles of academic freedom, free speech and shared governance, as well as for established protocols for hiring, tenure and promotion.

In both cases university officials acted to protect the reputation of their institutions. Bolt implied that Hirst’s tweets undermined Deakin’s commitment to benefiting students, staff and community. In a defence of their decision not to hire Salaita, Illinois officials emphasised their commitment to a university community that values civility.

The freedom of academics to express their ideas is central to the purpose of universities. It supports the ability of researchers to communicate their results and to debate important issues with their students without fear of interference by governments or interest groups. It enables academics to make a critical contribution to public life.

Profanity and insults do not advance scholarly debate. But even those who doubt that academic freedom extends to offensive remarks on Twitter ought to be disturbed about the sensitivity of academic institutions to critics like Bolt.

Universities face a competitive environment. They are subject to the cost-cutting policies of governments and the attacks of populist critics. There is a danger that their administrators will treat the freedom of academics to be controversial as a liability rather than an asset.

Both Hirst and Salaita were known to hold controversial views and were under scrutiny from those who opposed them. Punishing them for committing an indiscretion is a way of discouraging expression of unpopular views. A university can stand up for civility without suspending or rejecting those who overstep the mark.

Supporters of the university decisions think it is justified to protect students and colleagues from those who make insulting remarks. Would we want someone as a colleague who says “stupid as fuck people who just want to be stupid go be stupid with other stupid people”? Would a Jewish student feel comfortable in a class taught by someone who thinks that anyone who defends Israel is an awful human being? Should a university hire someone who makes remarks on Twitter that could be interpreted as racist?

These responses assume that everything that academics do is relevant to their suitability for employment. It makes no allowance for context. Neither Hirst nor Salaita were accused of making insulting remarks to students, failing to take their points of views seriously or for refusing to engage in reasoned debate.

They made their offensive remarks on Twitter – a form of communication that invites provocative statements and heated responses. Those responsible for hiring academics should hesitate to use tweets as grounds for a rejection. They have much better evidence for the suitability of a candidate at their disposal.

Salaita and his defenders claim that his criticisms of Israel do not amount to anti-Semitism. What if an academic were to tweet comments that are clearly racist or sexist? Would that disqualify them for a university position?

I don’t think so. Racist or sexist comments in any context are a good reason for scrutinising a person’s past behaviour as a teacher and researcher. But to reject a person simply for such remarks is to forget that people are not uniform in their behaviour or attitudes.

People act differently in different contexts. They can harbour reprehensible views about some topics and still be fair to their students and colleagues. Most of us in academia have had colleagues like that.

One lesson that academics might draw from these cases is “be careful of what you tweet”. But a better response would be to challenge the relevance of tweets to judgements about academic performance. To impose restrictions on how people can use social media is to treat them as if they are always on the job and can never be agitators or provocateurs as well as academics.