President Trump ended a circuitous search for the government’s top advocate before the Supreme Court by nominating Washington lawyer Noel J. Francisco as the next solicitor general.

Francisco had originally been named as the No. 2 in the solicitor general’s office, which represents the federal government in ­appellate courts. He might be best known as the lawyer who ­represented former Virginia ­governor Robert F. McDonnell last year when the Supreme Court unanimously overturned McDonnell’s conviction on corruption charges.

[Supreme Court overturns McDonnell’s conviction]

The solicitor general is considered to be one of the nation’s best legal jobs, and the occupant is often referred to as the “10th justice.” (Although Justice Elena Kagan, who held the job under President Barack Obama, joked that the court considered her more like “the 37th clerk.”)

Although the legal world is intensely interested in the ­solicitor general’s job, Francisco’s nomination was announced Tuesday night in a White House news release along with other nominations. The job requires Senate confirmation.

The small but elite solicitor general’s office is staffed mostly by career attorneys, with only two political appointees. People ­familiar with the plan said Jeffrey B. Wall, a veteran of the office who now works for the firm ­Sullivan & Cromwell, will assume Francisco’s role as principal ­deputy.

After Trump’s election, Francisco was among a number of conservative lawyers considered for the post.

According to lawyers who followed the process, representatives of the Trump transition approached U.S. Circuit Court Judge Brett Kavanaugh of the U.S. Court of Appeals for the District of Columbia Circuit — an influential judicial voice on the right — to see whether he would be interested in the job. Apparently, the discussion of whether Kavanaugh would be willing to leave his lifetime appointment to the bench did not advance very far.

For a time, there appeared to be two front-runners. One was George T. Conway III, a New York lawyer who received high marks from those in the Supreme Court bar and who is also married to Trump adviser Kellyanne Conway. The other was Charles Cooper, a Washington legal fixture and confidant of Attorney General Jeff Sessions.

Cooper pulled out of consideration, and the Trump administration expanded its search.

Francisco, meanwhile, has been in the office since January in the principal deputy’s job, and serving as the acting solicitor general. But he has had to recuse himself from some of the most important cases, such as the legal battle over Trump’s first travel ban executive order, because his law firm Jones Day represented parties in the dispute.

Francisco is a former clerk to Justice Antonin Scalia, and keeps a bobblehead figure of the former justice on his desk. Like other now powerful figures — Chief Justice John G. Roberts Jr. and Sen. Ted Cruz (R-Tex.) among them — Francisco was part of the team that represented President George W. Bush in the 2000 Florida presidential election recount.

From 2001 to 2003, Francisco served as associate counsel to the president, and from 2003 to 2005 he was deputy assistant attorney general in the Office of Legal Counsel.

He was raised in Oswego, N.Y., and both his undergraduate and law degrees are from the University of Chicago.

Besides his win in the McDonnell case, Francisco has argued two other times at the Supreme Court. In Zubik v. Burwell, he represented religiously affiliated organizations that said providing contraception services for their female employees would implicate them in sin. They said the accommodation offered by the Obama administration was not adequate. The eight-member court split on the case and sent it back to lower courts.

Francisco also successfully challenged the Obama administration’s view of the president’s recess appointment power in National Labor Relations Board v. Noel Canning.

One complication to Francisco’s nomination may be a law that limits the president’s ability to nominate a person to a job in which he already serves in an acting capacity.

But there appear to be ways around the restriction. According to sources, Wall will start at the solicitor general’s office Friday, and Francisco will move to another job in the Justice Department while he prepares for his confirmation hearing.