(Bastien Inzaurralde/The Washington Post)

The Senate confirmed John F. Kelly as secretary of homeland security on Friday, putting the blunt-spoken retired Marine general in charge of securing the nation’s borders, including construction of the controversial southwest border wall that was a centerpiece of President Trump’s campaign.

Senators approved Kelly’s nomination to run the Department of Homeland Security, a sprawling entity of more than 240,000 employees who do everything from protecting the president to safeguarding the nation’s electrical grid.

Kelly, who retired in February as chief of the U.S. Southern Command, is part of the first wave of Cabinet secretaries who will begin to implement the expansive plans of the nation’s 45th president.

DHS will be at the forefront of some of the most highly charged parts of that agenda, including the wall, which would be designed to keep out illegal immigrants. Kelly appeared to play down the wall’s importance at his recent confirmation hearing, telling a Senate committee that “a physical barrier in and of itself will not do the job’’ and that technology such as drones and sensors are also needed to secure the border.

Tracking how many key positions Trump has filled so far

Kelly will also oversee Trump’s promised broader crackdown on undocumented immigrants, which Trump has said will include beefing up the numbers of border and immigration agents in an expensive and logistically difficult operation to remove millions of people from the country. Democrats and advocates for immigrants have vowed to fight any nationwide sweeps.

A widely respected officer who served for more than 40 years, Kelly won strong support from Republicans, who hailed his military experience and the border expertise he gained at Southern Command.

“General Kelly has devoted his life to service, and I’m thankful that the full Senate has recognized that he is the right person to be the secretary of the Department of Homeland Security,” said Sen. Ron Johnson (R-Wis.), chairman of the Senate Homeland Security and Governmental Affairs Committee.

Democrats also spoke about him in mostly positive terms, though Sen. Kamala Harris (D-Calif.), a member of the Senate committee, announced this week she would vote against him.

She cited Kelly’s “failure to provide assurances’’ to beneficiaries of the Obama administration’s Deferred Action for Childhood Arrivals program, known as DACA. The 2012 initiative has given temporary protection from deportation to hundreds of thousands of people who arrived in the United States as children. Trump vowed during the campaign to reverse it, but Kelly said in his hearing that he would “keep an open mind” about the program.

Kelly struck a markedly different tone than Trump on a number of issues, including a ban on all Muslims entering the United States, which Trump had described as a counterterrorism necessity. Kelly noted that when he was a Marine officer in Iraq, his forces secured stability in part by reaching out to clerics and other Muslim leaders.

Trump’s team was drawn to Kelly because of his experience at Southern Command overseeing military operations and liaison relationships across Central and South America, and working with several DHS agencies. Kelly was also a member of the Homeland Security Advisory Council, which advised former DHS secretary Jeh Johnson on security issues.

Earlier in his career, Kelly served as the assistant commander of the 1st Marine Division during the invasion of Iraq in 2003. He returned there again in 2004, and a third time in 2008, when he was named the top U.S. commander in western Iraq. He also worked in the Obama administration as a senior military adviser to defense secretaries Robert M. Gates and Leon E. Panetta.