Reports of McMaster's ouster had surfaced last week but the White House had dispelled them saying that there were no changes at the National Security Council (NSC).
Trump, however, took to Twitter today to make an announcement in this regard.
The announcement of McMaster's ouster, who the White House said had a "good working relationship" with Trump, is the latest in a string of high-profile White House departures since President Trump took office in January 2017.
"I am pleased to announce that, effective 4/9/18, John Bolton will be my new National Security Adviser," Trump said on Twitter.
"I am very thankful for the service of General H.R. McMaster who has done an outstanding job & will always remain my friend. There will be an official contact handover on 4/9," Trump said.
According to a White House official, Trump and McMaster mutually agreed that the latter will resign as the National Security Adviser (NSA). He will retire from the US Army after 34 years of distinguished service.
"The two have been discussing this for some time. The timeline was expedited as they both felt it was important to have the new team in place, instead of constant speculation. This was not related to any one moment or incident, rather it was the result of ongoing conversations between the two," the official said.
The White House has described Bolton, who replaces McMaster, as one of the strongest voices and experts on the full range of national security issues and challenges facing the country.
Bolton served as US Permanent Representative to the United Nations from 2005-2006 and as Under Secretary of State for Arms Control and International Security from 2001-2005.
In a statement, Trump said McMaster has served his country with distinction for more than 30 years.
"He has won many battles and his bravery and toughness are legendary. General McMaster's leadership of the National Security Council staff has helped my administration accomplish great things to bolster America's national security," he said.
"He helped develop our America First National Security Strategy, revitalise our alliances in the Middle East, smash ISIS, bring North Korea to the table, and strengthen our nation's prosperity. This work and those achievements will ensure that America builds on its economic and military advantages. I thank General McMaster and his family for their service and wish them the very best," Trump said.
The White House Chief of Staff, General (rtd) John Kelly said McMaster, a fine American and military officer, has served with distinction and honour throughout his career in the US Army and as the NSA.
"He brought and maintained discipline and energy to our vital interagency process. He helped develop options for the President and ensured that those options were presented fully and fairly. A true solider-scholar, his impact on his country and this government will be felt for years to come," Kelly said.
McMaster said after 34 years of service, he is requesting retirement from the US Army effective this summer after which he will leave public service.
"Throughout my career, it has been my greatest privilege to serve alongside extraordinary service members and dedicated civilians.
"I am thankful to President Donald J. Trump for the opportunity to serve him and our nation as national security adviser. I am grateful for the friendship and support of the members of the National Security Council who worked together to provide the President with the best options to protect and advance our national interests," McMaster said.
Bolton, during his tenure at the United Nations, was a leading voice on the need for the Security Council to take strong and meaningful action against international proliferation and terrorism.
Along with France's ambassador, Bolton led the Security Council to approve a unanimous resolution to end the summer 2006 Hezbollah war on Israel, to authorise UN peacekeepers and to create an arms embargo against Hezbollah. He also assembled an international coalition that blocked the bid of Hugo Chavez, Venezuela's Marxist strongman, to join the Security Council.
As Under Secretary, he repeatedly advocated tough measures against the nuclear weapons programs of both Iran and North Korea, and the proliferation of weapons of mass destruction generally. He led negotiations for America to withdraw from the 1972 Anti-Ballistic Missile Treaty so that the Bush administration could proceed with a national missile-defence program.
Author of "Surrender is Not an Option: Defending America at the UN and Abroad", Bolton currently is counsel at Kirkland & Ellis LLC with a focus on counselling clients on domestic and international issues in complex corporate, litigation, internal investigations, regulatory and competition matters