(CNN) House Speaker Paul Ryan on Tuesday defended his endorsement of Donald Trump -- despite his frequent differences with the presumptive GOP nominee -- saying the only alternative is giving the presidency to Hillary Clinton.

"It is a binary choice," Ryan said at a CNN town hall hosted by Jake Tapper. "It is either Donald Trump or Hillary Clinton. You don't get a third option."

But the challenge facing Ryan was clear when he was asked a question by Zachary Marcone, a Republican who said he couldn't support Trump because he is "openly racist."

"Can you tell me, how can you morally justify your support for this kind of candidate?" Marcone asked.

Ryan didn't address the premise of the question, reiterating his stance that opposing Trump amounts to supporting Clinton. He pledged to always speak his mind when he disagrees with Trump but argued that the best chance for conservatives to have their priorities signed into law is with the businessman in the White House and pointed to the ability of the next president to nominate Supreme Court justices.

Trump is joined by his family as he is sworn in as President on January 20.

Trump is joined by his family as he is sworn in as President on January 20.

Trump walks on stage with his family after he was declared the election winner on November 9. "Ours was not a campaign, but rather, an incredible and great movement," he told his supporters in New York.

Trump walks on stage with his family after he was declared the election winner on November 9. "Ours was not a campaign, but rather, an incredible and great movement," he told his supporters in New York.

Trump apologizes in a video, posted to his Twitter account in October, for vulgar and sexually aggressive remarks he made a decade ago regarding women. "I said it, I was wrong and I apologize," Trump said, referring to lewd comments he made during a previously unaired taping of "Access Hollywood." Multiple Republican leaders rescinded their endorsements of Trump after the footage was released.

Trump faces Democratic nominee Hillary Clinton in the first presidential debate, which took place in Hempstead, New York, in September.

Trump delivers a speech at the Republican National Convention in July, accepting the party's nomination for President. "I have had a truly great life in business," he said. "But now, my sole and exclusive mission is to go to work for our country -- to go to work for you. It's time to deliver a victory for the American people."

Trump delivers a speech at the Republican National Convention in July, accepting the party's nomination for President. "I have had a truly great life in business," he said. "But now, my sole and exclusive mission is to go to work for our country -- to go to work for you. It's time to deliver a victory for the American people."

Trump speaks during a campaign event in Evansville, Indiana, on April 28. After Trump won the Indiana primary, his last two competitors dropped out of the GOP race.

Trump speaks during a campaign event in Evansville, Indiana, on April 28. After Trump won the Indiana primary, his last two competitors dropped out of the GOP race.

Trump -- flanked by U.S. Sens. Marco Rubio, left, and Ted Cruz -- speaks during a CNN debate in Miami on March 10. Trump dominated the GOP primaries and emerged as the presumptive nominee in May.

Trump -- flanked by U.S. Sens. Marco Rubio, left, and Ted Cruz -- speaks during a CNN debate in Miami on March 10. Trump dominated the GOP primaries and emerged as the presumptive nominee in May.

Trump speaks in Sarasota, Florida, after accepting the Statesman of the Year Award at the Sarasota GOP dinner in August 2012. It was shortly before the Republican National Convention in nearby Tampa.

Trump speaks in Sarasota, Florida, after accepting the Statesman of the Year Award at the Sarasota GOP dinner in August 2012. It was shortly before the Republican National Convention in nearby Tampa.

Trump poses with Miss Universe contestants in 2011. Trump had been executive producer of the Miss Universe, Miss USA and Miss Teen USA pageants since 1996.

Trump poses with Miss Universe contestants in 2011. Trump had been executive producer of the Miss Universe, Miss USA and Miss Teen USA pageants since 1996.

Trump appears on the set of "The Celebrity Apprentice" with two of his children -- Donald Jr. and Ivanka -- in 2009.

Trump appears on the set of "The Celebrity Apprentice" with two of his children -- Donald Jr. and Ivanka -- in 2009.

For "The Apprentice," Trump was honored with a star on the Hollywood Walk of Fame in January 2007.

For "The Apprentice," Trump was honored with a star on the Hollywood Walk of Fame in January 2007.

Trump wrestles with "Stone Cold" Steve Austin at WrestleMania in 2007. Trump has close ties with the WWE and its CEO, Vince McMahon.

Trump wrestles with "Stone Cold" Steve Austin at WrestleMania in 2007. Trump has close ties with the WWE and its CEO, Vince McMahon.

Trump attends the U.S. Open tennis tournament with his third wife, Melania Knauss-Trump, and their son, Barron, in 2006. Trump and Knauss married in 2005.

Trump attends the U.S. Open tennis tournament with his third wife, Melania Knauss-Trump, and their son, Barron, in 2006. Trump and Knauss married in 2005.

Trump attends a news conference in 2005 that announced the establishment of Trump University. From 2005 until it closed in 2010, Trump University had about 10,000 people sign up for a program that promised success in real estate. Three separate lawsuits -- two class-action suits filed in California and one filed by New York's attorney general -- argued that the program was mired in fraud and deception. Trump's camp rejected the suits' claims as "baseless." And Trump has charged that the New York case against him is politically motivated.

A 12-inch talking Trump doll is on display at a toy store in New York in September 2004.

A 12-inch talking Trump doll is on display at a toy store in New York in September 2004.

An advertisement for the television show "The Apprentice" hangs at Trump Tower in 2004. The show launched in January of that year. In January 2008, the show returned as "Celebrity Apprentice."

An advertisement for the television show "The Apprentice" hangs at Trump Tower in 2004. The show launched in January of that year. In January 2008, the show returned as "Celebrity Apprentice."

Trump dips his second wife, Marla Maples, after the couple married in a private ceremony in New York in December 1993. The couple divorced in 1999 and had one daughter together, Tiffany.

Trump dips his second wife, Marla Maples, after the couple married in a private ceremony in New York in December 1993. The couple divorced in 1999 and had one daughter together, Tiffany.

Trump and singer Michael Jackson pose for a photo before traveling to visit Ryan White, a young child with AIDS, in 1990.

Trump and singer Michael Jackson pose for a photo before traveling to visit Ryan White, a young child with AIDS, in 1990.

Trump signs his second book, "Trump: Surviving at the Top," in 1990. Trump has published at least 16 other books, including "The Art of the Deal" and "The America We Deserve."

Trump attends the opening of his new Atlantic City casino, the Taj Mahal, in 1989.

Trump attends the opening of his new Atlantic City casino, the Taj Mahal, in 1989.

Trump uses his personal helicopter to get around New York in 1987.

Trump uses his personal helicopter to get around New York in 1987.

Trump was married to Ivana Zelnicek Trump from 1977 to 1990, when they divorced. They had three children together: Donald Jr., Ivanka and Eric.

Trump was married to Ivana Zelnicek Trump from 1977 to 1990, when they divorced. They had three children together: Donald Jr., Ivanka and Eric.

Trump attends an event to mark the start of construction of the New York Convention Center in 1979.

Trump attends an event to mark the start of construction of the New York Convention Center in 1979.

Trump stands with Alfred Eisenpreis, New York's economic development administrator, in 1976 while they look at a sketch of a new 1,400-room renovation project of the Commodore Hotel. After graduating college in 1968, Trump worked with his father on developments in Queens and Brooklyn before purchasing or building multiple properties in New York and Atlantic City, New Jersey. Those properties included Trump Tower in New York and Trump Plaza and multiple casinos in Atlantic City.

Trump stands with Alfred Eisenpreis, New York's economic development administrator, in 1976 while they look at a sketch of a new 1,400-room renovation project of the Commodore Hotel. After graduating college in 1968, Trump worked with his father on developments in Queens and Brooklyn before purchasing or building multiple properties in New York and Atlantic City, New Jersey. Those properties included Trump Tower in New York and Trump Plaza and multiple casinos in Atlantic City.

Trump, center, wears a baseball uniform at the New York Military Academy in 1964. After he graduated from the boarding school, he went to college. He started at Fordham University before transferring and later graduating from the Wharton School, the University of Pennsylvania's business school.

Trump, center, wears a baseball uniform at the New York Military Academy in 1964. After he graduated from the boarding school, he went to college. He started at Fordham University before transferring and later graduating from the Wharton School, the University of Pennsylvania's business school.

Trump, center, stands at attention during his senior year at the New York Military Academy in 1964.

Trump, center, stands at attention during his senior year at the New York Military Academy in 1964.

Trump, left, in a family photo. He was the second-youngest of five children.

Trump, left, in a family photo. He was the second-youngest of five children.

Trump at age 4. He was born in 1946 to Fred and Mary Trump in New York City. His father was a real estate developer.

Trump at age 4. He was born in 1946 to Fred and Mary Trump in New York City. His father was a real estate developer.

President-elect Donald Trump has been in the spotlight for years. From developing real estate and producing and starring in TV shows, he became a celebrity long before winning the White House.

President-elect Donald Trump has been in the spotlight for years. From developing real estate and producing and starring in TV shows, he became a celebrity long before winning the White House.

He was later asked by Kerry Cahill, the daughter of a man killed in the 2009 Fort Hood massacre, how he could support Trump after he called for a ban on Muslim immigration. Ryan was more direct on that question.

"I disagree with him on it," Ryan said. "It's just that simple."

As he spoke of the next president's ability to choose Supreme Court nominees and influence the high court over the long term, Ryan criticized Ruth Bader Ginsburg. The 83-year-old justice is the subject of controversy after she told CNN this week that Trump is a "faker" who is driven by his ego.

"I think it is out of place in an appointed branch of government. That shows bias to me," Ryan said. "I don't think that is something she should have done."

The speaker has one of the toughest jobs in politics right now: safeguarding the future of the Republican Party while simultaneously uniting the party around its controversial presumptive nominee. He is gearing up for the perilous political mission of guiding the GOP through next week's Republican National Convention.

He pledged Tuesday to speak out and defend his principles whenever they diverge with those of Trump.

"In the balance of things, the good clearly outweighs the things I don't agree with," Ryan said. "We don't have people who run for office who 100% reflect all of our views. It doesn't work like that."

The speaker has frequently been drawn into the center of controversy during the presidential campaign, sometimes scolding Trump or simply keeping his distance while also encouraging the party to support Trump to avoid a Clinton win in November.

Ryan, for instance, repudiated Trump's attacks on an American-born judge of Mexican ancestry who is presiding over a civil suit against the billionaire. Ryan, who endorsed Trump in June, said those comments met the "textbook" definition of racism.

The audience included Mark Hughes, a man who was pictured legally carrying a rifle on the night of the attacks that killed five police officers in Dallas last week. Police initially misidentified him as a suspect and his picture was posted on Twitter.

Hughes, a Democrat, asked Ryan a question about improving health care for returning veterans who may have post-traumatic stress disorder and asked him what he would do to ensure guns did not get into the hands of people with mental disorders.

Ryan said the House had just passed the first mental health legislation in a generation and said there was common ground between Republicans and Democrats on the issue. He also pledged that "we have got to clean up the VA" so that it could treat issues unique to veterans, including PTSD.

Ryan deflected a question from audience member Steve Lonegan, a New Jersey Republican, who wants to incite a revolt to stop Trump from claiming the nomination.

"It is not my job as chairman of the convention to tell the delegates how to run their convention," the speaker said.

Ryan, the party's 2012 vice presidential nominee, had advice for Trump as he nears a decision on a running mate.

"I would like a conservative," Ryan said, adding that Trump was "new" to Republican politics and had been on the different sides of many political issues.