US Senate Majority Leader Mitch McConnell (R-KY) speaks as US President Donald Trump looks on during a 'Make America Great Again' rally at the Eastern Kentucky University, in Richmond, Kentucky, on October 13, 2018.

In his first two years in office, President Donald Trump has moved to appoint dozens of conservative judges to the federal bench, moving faster than any president since at least Ronald Reagan.

On top of two Supreme Court justices, Trump has appointed 29 judges to U.S. appeals courts across the country, according to a Reuters tally. The appointments, Majority Leader Sen. Mitch McConnell has said, are his "top priority."

Now, unleashed by a decisive Republican victory in the Senate in Tuesday's midterm elections, the president's ability to shape the ideological makeup of the federal judiciary has only increased.

To be sure, it's impossible to predict how a judge will rule simply based on the party they belong to, or the party of the president who appoints them. But an ideologically conservative federal bench could prove useful to the president as he pursues an agenda that has often ended up in the courts.

"They are the ones that judge all your disputes," Trump said during a speech in Ohio earlier this year. "They judge on what's fair on the environment and what's not fair. Where they're going to take your farms and factories away and where they're not."

It's a lesson Trump has learned firsthand. In his first days in office, U.S. District Judge Ann Donnelly, an Obama appointee, struck down the first iteration of his travel ban. A later version of the ban was later halted from going into effect via rulings from two other Obama appointees sitting in Maryland and Hawaii.

A third version of the ban was ultimately upheld by the Supreme Court in a landmark 5-4 ruling along party lines.

The Trump administration's antipathy toward the lower courts, which have blocked the president's policies not only on immigration but also on transgender rights, the environment and other matters, has led it to bypass the appeals courts entirely with unusual frequency and go straight to the Supreme Court.

The 9th Circuit, headquartered in San Francisco, has been the primary target of the president's ire. That court currently has six vacancies.

"It just shows everyone how broken and unfair our Court System is when the opposing side in a case (such as DACA) always runs to the 9th Circuit and almost always wins before being reversed by higher courts," Trump wrote in a January post on Twitter.

Even if the president fills all of the vacancies on the 29-member court, however, the majority of its judges would still be Democratic appointees. The president is likely to have more luck with other circuits.

Both the Atlanta-based 11th Circuit Court of Appeals and the Philadelphia-based 3rd Circuit appear most likely to flip to a majority of Republican-appointed judges. The 3rd Circuit currently has a 7-6 Democratic majority, according to Reuters. In the 11th, the split is an even 6-6.

The Republican victory on Tuesday could deliver an even bigger prize to the president.

The two oldest judges on the Supreme Court are the liberal Justices Ruth Bader Ginsburg, 85, and Stephen Breyer, 80. While neither has indicated they plan to retire any time soon, the average age of retirement for modern Supreme Court justices is 79, according to a 2006 study.