Queen Elizabeth has confirmed Theresa May as Britain's prime minister and invited her to form a new government, after the monarch accepted the resignation Wednesday of David Cameron at Buckingham Palace.

The 59-year-old May is expected to unveil her Cabinet lineup soon, which will include a minister in charge of implementing Britain's exit from the EU.

In her first speech as prime minister, May said she plans to lead in the spirit of unity and build a country that “works for everyone.'' She said she will fight against social injustice, and she believes in the unity of all aspects of Britain.

"We will rise to the challenge. As we leave the European Union, we will forge a bold new positive role for ourselves in the world, and we will make Britain a country that works not for a privileged few, but for every one of us," she said.

"The government I lead will be driven not by the interests of the privileged few, but by yours. We will do everything we can to give you more control over your lives."

Acknowledging the everyday life difficulties faced by many Britons, May said her government will first think about and listen to common people.

"When we take the big calls we will think not of the powerful, but you, when we pass new laws we will listen not to the mighty, but to you, when it comes to taxes we will prioritize not the wealthy, but you."

The United States congratulated May and said it is confident in her ability to lead Britain through the Brexit negotiations.

Although May, former Home Secretary in Cameron's cabinet, supported Britain staying in the bloc, she said earlier this week that "Brexit means Brexit," but stressed the need "to negotiate the best deal for Britain in leaving the EU."

May, the second female British prime minister after Margaret Thatcher, also has said she will not initiate the exit negotiations before the end of the year.

Before heading to the audience with the queen, Cameron said outside the prime minister's residence at 10 Downing Street that it was the "greatest honor'' of his life to serve as prime minister. Surrounded by his wife and their three children, Cameron offered an assessment of his tenure, saying he left the country stronger and better off.

Cameron wished his successor luck in her negotiations to have Britain leave the European Union, the matter that forced him to leave the office.

Earlier in the day, Cameron made his final appearance in the House of Commons, where he received a standing ovation for his performance after six years in the job.

The normally raucous prime minister's questions turned into a friendly session Wednesday when Cameron was praised for helping to reduce unemployment, fund the National Health Service, and improve educational opportunities.

Cameron also gave all but a guarantee to European Union citizens living in Britain that they would not be forced to leave the country when Britain leaves the bloc.

He said the government is working hard "to do what we want, which is to give a guarantee to EU citizens that they will have their rights respected."

Cameron resigned after Britain's narrow vote in the referendum of June 23 to leave the EU. He had backed the "Remain" in the bloc campaign.