Lord Gus O'Donnell made the remarks after the brutal dismissal Mr Williamson from the Ministry of Defence, as he was accused of leaking from a highly-sensitive National Security Council (NSC) meeting - a claim he has emphatically rejected.
Calls are also mounting from political parties for the police to launch a criminal investigation into the leak and disclosure of the government's decision to allow the Chinese telecommunications giant Huawei access to the UK's 5G mobile network.
It is expected the government will face questions over Mr Williamson's sacking in the House of Commons on Thursday morning following an urgent question submitted by the Labour Party.
Lord O'Donnell, who helped set up the NSC during his time as cabinet secretary, the most senior position in the civil service, said there would have been "only one person making the decision" to sack Mr Williamson - the prime minister.
Referring to accusations of a vendetta launched against Mr Williamson by the current cabinet secretary Mark Sedwill, he told BBC Radio 4's Today programme: "The cabinet secretary is giving advice to her [Ms May]. The cabinet secretary is saying this is a matter for the violation of the ministerial code, it is not a breach of the Official Secrets Act that is putting lives at risk.
"That is why it is a matter for the prime minister to decide does she want this person in her team when faced with this evidence and she has basically decided he is not the Lionel Messi of the cabinet and she can do without him.
"His job [Mark Sedwill] is to defend the principle of cabinet government, to look after the security of the National Security Council (NSC) and to advise the prime minister. She decides on what action to take and it is her that decided on the basis of this evidence that she wanted to say farewell."
Asked whether there should be a police inquiry into the leak and Mr Williamson's conduct - as demanded by the Labour Party - he said: "Well it's perfectly legitimate for anyone to ask the police to investigate something - it's up to the police then to discuss it.
"But they will face exactly the same issues we've been talking about, will they get a journalist on the record to disclose what has been said?"
Foreign secretary Jeremy Hunt added on Thursday that the police, not politicians, should decide whether to launch a criminal investigation into the Huawei leak.
In response to a question from the Press Association during a World Press Freedom Day forum at the African Union in Addis Ababa, Ethiopia, Mr Hunt said: "Let me say that, when it comes to issues like whether there should be a police investigation or not, there's a very, very important principle of our system that those decisions are not made by politicians, they are made independently by police.
"And that has to be the correct way forward in this situation."
But ex-Army chief General Lord Dannatt defended Mr Williamson's performance as defence secretary, adding: "This is a personal tragedy for Gavin Williamson; it's also something of a tragedy, certainly very upsetting, for defence at the present moment.
"It's a very difficult brief, people take quite some time to learn it, and he has got to grips with it pretty well over the last 18 months. He got £1.8 billion extra in the Budget last year and was continuing to argue the case for more resources in the spending review and he was fighting his corner.
"Yes, he made some mistakes, he made some gaffes, and said some things that he probably regretted, but on the whole he was doing a good job."
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies