The U.S. Senate confirmed Alejandro Mayorkas as secretary of the Department of Homeland Security in a largely party-line vote Tuesday, ending what has been the most contentious confirmation process of Biden’s Cabinet picks.

Mayorkas, 61, is the son of Jewish refugees from Cuba who goes by the nickname “Ali.” A former federal prosecutor in Los Angeles, Mayorkas served as a top DHS official during the Obama administration and played a key role in the creation of the Deferred Action for Childhood Arrivals program known as DACA.

“Mr. Mayorkas’ qualifications are unassailable: he is a seven-year veteran of the DHS and has already been confirmed by this chamber three — three — times,” Senate Majority Leader Charles E. Schumer (D-N.Y.) said in a statement before the vote. “Like most of President Biden’s cabinet nominees, his nomination is also history-making: he will be the first Latino and first immigrant to hold the top job at DHS.”

The Senate voted 56 to 43 to confirm Mayorkas. Six GOP members voted with the Democrats: Mitt Romney (Utah), Susan Collins (Maine), Lisa Murkowski (Alaska), Rob Portman (Ohio), Shelley Moore Capito (West Virginia) and Dan Sullivan (Alaska).

DHS has not had a Senate-confirmed secretary since April 2019, when President Trump ousted Kirstjen Nielsen and allowed the department to drift through a period of unprecedented leadership turnover. Some of the Republican senators who joined Democrats in voting to confirm Mayorkas have said they wanted to see DHS stabilized without further delay.

Democrats had sought to fast-track a confirmation vote, but they were blocked by Sen. Josh Hawley (R-Mo.), who cited a 2015 DHS inspector general report criticizing Mayorkas for appearing to favor well-connected applicants to an investor visa program.

Senate Minority Leader Mitch McConnell (R-Ky.), cited that report in voting against Mayorkas, blasting him as an “ethically-compromised partisan lawyer.”

“Mr. Mayorkas is all too familiar with the levers of power that control U.S. immigration law. The problem is when he’s chosen to pull those levers — and for whose benefit,” McConnell said in a statement, accusing Mayorkas of running U.S. Citizenship and Immigration Services as “an unethical favor factory for Democratic Party royalty” during President Barack Obama’s first term.

Democrats rebuffed GOP calls for Mayorkas to submit additional testimony to the Senate Judiciary Committee, arguing that the country’s national security needed a confirmed DHS leader as soon as possible. They noted Trump’s first DHS secretary, retired Gen. John F. Kelly, was confirmed on Inauguration Day in 2017.

Mayorkas faced a rockier path. During his confirmation hearing, Republican senators repeatedly raised the 2015 inspector general report and expressed concerns about the Biden administration’s plans to reverse Trump-era border controls and deportation efforts.

DHS, the country’s third-largest federal department, is responsible for safeguarding the country’s borders and coastlines, running its immigration system, protecting federal officials and property and responding to crisis and disasters, among other tasks.

“Mr. Mayorkas is a proven leader who has the experience to protect the American people from harm,” Sen. Gary Peters (D-Mich.) said before casting his vote.

Created after the Sept. 11, 2001, terrorist attacks, the department had a primary focus on counterterrorism before the Trump era. Trump made DHS a major instrument of his domestic policy agenda, particularly at the Mexico border. Mayorkas takes over the department after a period of intense politicization and even some calls to dismantle the department.

Immigration issues probably will occupy much of Mayorkas’s attention at DHS. Illegal crossings along the border have been rising again in recent months despite pandemic orders restricting legal travel. Biden has ordered a halt to construction of Trump’s border wall. Another of Biden’s first measures — a 100-day “pause” on most deportations from the U.S. interior — has been blocked by a federal judge in Texas.

Biden planned to issue several executive orders Tuesday that will order reviews of Trump’s attempts to tighten access to the U.S. asylum system as well as other legal immigration benefits. Biden also is scheduled to announce a task force to reunite children separated from their parents by Trump’s border crackdown. Mayorkas will lead that task force.

Mayorkas is also expected to help the Biden administration advance an immigration bill putting millions on a path to legal status. Many Republicans denounce Biden’s proposal as “amnesty” and say it will fail like previous attempts to overhaul the country’s immigration system.