May appointed worldwide development minister Penny Mordaunt to succeed Williamson as defence secretary, and named prisons minister Rory Stewart to Mordaunt's former role.
"The Theresa May's decision has been informed by his conduct surrounding an investigation into the circumstances of the unauthorised disclosure of information from a meeting of the National Security Council".
Penny Mordaunt, who was global development secretary, has been appointed in Mr Williamson's place.
The investigation caused May to "lose confidence" in Williamson, and resulted in her asking him to leave the government, said 10 Downing Street in an official statement.
In a letter to Mr Williamson, Mrs May said that the leak from the April 23 meeting was "an extremely serious matter and a deeply disappointing one".
Williamson was replaced on Wednesday evening by Penny Mordaunt.
At the same time, US officials have been pressing allies to bar Huawei from building their nation's super-fast 5G networks, fearful that Chinese cyberspies could tap user data through backdoor access.
Former Defence Secretary Gavin Williamson and Prime Minister Theresa May [PA]"I am therefore concerned by the manner in which you have engaged with this investigation".
May told Williamson it was "vital" that members of the NSC... were able to have "frank and detailed discussions in full confidence" that they would not be made public.
His colleague, foreign minister Jeremy Hunt, said he was sorry over Williamson's firing "but given the gravity of the situation there was no other alternative outcome", the Press Association quoted Hunt as saying as he arrived in Addis Ababa.
Cabinet Secretary Mark Sedwill began an investigation, and in a meeting with Williamson on Thursday evening, May told the defense secretary he hadn't cooperated to "the same standard" as others. "I strenuously deny that I was in any way involved in this leak and I am confident that a through and formal injury would have vindicated my position", Williamson wrote in a letter to May.
For the prime minister's allies, it will show that she is, despite the political turmoil, still strong enough to move some of her ministers around - to hire and fire.
'The Prime Minister thanks all members of the National Security Council for their full cooperation and candour during the investigation and considers the matter closed'.
Mordaunt will retain responsibility for women and equalities in her new role.
Rory Stewart, another potential leader but one who has been loyal to May and backs her Brexit deal, replaces Mordaunt as global development secretary.
Senior people from the National Cyber Security Council refused to comment on the leak when The Register asked them about it last week at their annual Cyber UK shindig in Glasgow.
No other, credible version of events to explain this leak has been identified.
The letter states: "I am writing to ask you to open a criminal investigation to ascertain whether the actions of Mr Williamson constitute a breach of the Official Secrets Act".
The disclosure of details of the meeting, within hours of it taking place, outraged security officials and prompted ministers to write to May demanding an inquiry.