Paul Ryan, the House speaker, has condemned Donald Trump for "the textbook definition of a racist comment" for his claim a judge of Mexican heritage could not judge him fairly, but stood by his decision to support the presumptive Republican nominee for president.

Ryan's counterpart in the Senate, Mitch McConnell, said Trump should stop attacking minority groups.

"My advice to our nominee is to start talking about the issues that the American people care about, and to start doing it now," the Senate Republican leader told reporters on Tuesday. "In addition to that, it's time to quit attacking various people that you competed with or various minority groups in the country and get on message."

A press conference on Tuesday illustrated the bind that Ryan, McConnell and other senior Republicans now find themselves in, defending their candidate while distancing themselves from his more outlandish statements, which only deflect attention from their policy vision.

Later on Tuesday afternoon Illinois's Mark Kirk became the first Republican senator to withdraw his previous support for Trump as the Republican nominee.

Kirk, a first time Republican senator up for re-election in his blue home state this year, issued a statement saying: "I have spent my life building bridges and tearing down barriers - not building walls. That's why I find Donald Trump's belief that an American-born judge of Mexican descent is incapable of fairly presiding over his case is not only dead wrong, it is un-American."

He added that Trump "has not demonstrated the temperament necessary to assume the greatest office in the world". Previously Kirk had said he "certainly would" support Trump if he was the nominee. Kirk told reporters that instead he would cast a write-in vote for retired military general David Petraeus in November.

Meanwhile Arizona Republican Jeff Flake, who has yet to endorse Trump, suggested that the presumptive nominee should still be challenged at the Republican convention in Cleveland next month. He told reporters on Tuesday: "Where there's no talk of a convention challenge or anything else, this might spur it." Flake added: "That's not somebody who can win the White House."

Ryan has been fiercely criticised in some quarters for caving in and endorsing Trump last week, despite the candidate's extreme positions. Soon after he did, Trump claimed that a US district judge, Gonzalo Curiel, who is presiding over a case alleging that Trump University exploited students, cannot judge him fairly because he is of Mexican heritage and Trump wants to build a wall between the US and Mexico.

"I regret those comments that he made," Ryan said on Tuesday. "Claiming a person can't do their job because of their race is sort of like the textbook definition of a racist comment I think that should be absolutely disavowed. It's absolutely unacceptable.

"But do I believe Hillary Clinton is the answer? No, I do not … I believe that we have more common ground on the policy issues of the day, and we have more likelihood of getting our policies enacted with him than we do with her."

He added: "But I do absolutely disavow those comments, I think they're wrong, I don't think they're right-headed, and the thinking behind it is something I don't even personally relate to. But at the end of the day, this is about ideas. This is about moving our agenda forward and that's why we're moving the way we're moving."

Later on Tuesday afternoon, Trump responded to the barrage of criticism. "It is unfortunate that my comments have been misconstrued as a categorical attack against people of Mexican heritage," he said in a statement. "I am friends with and employ thousands of people of Mexican and Hispanic descent.

"The American justice system relies on fair and impartial judges. All judges should be held to that standard. I do not feel that one's heritage makes them incapable of being impartial, but, based on the rulings that I have received in the Trump University civil case, I feel justified in questioning whether I am receiving a fair trial."

Trump accused the media of misreporting the case and insisted that he was fighting to stop companies moving production to Mexico, while drugs and illegal immigrants were "pouring across our border". He added: "This is bad for all Americans, regardless of their heritage.

"Due to what I believe are unfair and mistaken rulings in this case and the judge's reported associations with certain professional organizations, questions were raised regarding the Obama appointed judge's impartiality. It is a fair question. I hope it is not the case."

Trump does not intend to comment on the case further, he said.

Ryan had invited media to a residential alcohol and drug treatment programme in Anacostia, a predominantly black neighbourhood of Washington, to unveil his proposals to combat poverty, the start of a six-part governing agenda from House Republicans. But questions inevitably focused on Trump, to the irritation of Ryan's press secretary, AshLee Strong, who tweeted: "Way to go reporters: first question at a poverty forum: Trump. Slow clap."

The questions for Ryan came after 25 minutes of speeches in which the House speaker paid tribute to Shirley Holloway, founder of the House of Help City of Hope residence, and joined several House committee chairmen in arguing for a "bottom up" approach to beating poverty rather than "top down" welfare programmes.

Asked if he was frustrated by Trump undercutting such messages, the speaker admitted frankly: "I do think these kind of comments undercut these things and I'm not even going to pretend to defend them. I'm going to defend our ideas, I'm going to defend our agenda. What matters to us most is our principles and the policies that come from those principles."

Whatever their qualms about him as a loose canon, Trump is ultimately seen as the pragmatic choice by Ryan and senior Republican allies to maintain party unity, win elections and implement their vision.

Ryan had had an "exhaustive" discussion with Trump personally about anti-poverty policies, he added, "and that is why I believe that we are far better off advancing these policies, getting them into law, with his candidacy than we clearly are with Hillary Clinton".

But asked about Trump's refusal to back down on his comments about Judge Curiel, the 2012 Republican vice-presidential nominee said: "I think it's wrong. The way I look at this is, if you say something that's wrong, I think the mature and responsible thing is to acknowledge that it's wrong.

"I am not going to defend these kind of comments because they're indefensible. I'm going to defend our ideas, I'm going to defend our majority … I see it as my job as speaker of the House to help keep our party unified. I think if we go into the fall as a divided party, we are doomed to lose."

The judge controversy has rattled the Republican leadership on Capitol Hill just as it was twisting and turning its way into embracing Trump. Several prominent party figures and commentators have denounced him.

George Will, a columnist for the National Review, questioned the calculation behind Ryan's compromise. "The Caligulan malice with which Donald Trump administered Paul Ryan's degradation is an object lesson in the price of abject capitulation to power," he wrote. "This episode should be studied as a clinical case of a particular Washington myopia - the ability of career politicians to convince themselves that they and their agendas are of supreme importance."

He added: "Ryan has now paid a staggering price by getting along with Trump. And what did Ryan purchase with the coin of his reputation? Perhaps his agenda."

Visiting House of Help City of Hope for the third time, Ryan claimed his proposals will create incentives to improve welfare, food and housing aid programmes, reward work ("a good job is the surest way out of poverty"), tailor benefits to people's needs, improve skills and schools, make it easier for families to plan for retirement and open up the system to accountability and collaboration with local communities, "backing ideas that work on the front lines every day".

The plan - "a better way" - would make aid more efficient and allow states to make more decisions about how it is distributed.

He argued that far-reaching change is needed because current programmes have not changed the poverty rate over the past half century and the government measures success by treating the symptoms of poverty, not finding a cure. "We should measure success based on results, outcomes," he said.

In a speech in Indiana last week, Barack Obama railed against his Republican critics and said there are fewer families on welfare now than in the 1990s, despite "tales about welfare queens, talking about takers, talking about the '47%'", he said, mocking his opponents' position.

Nancy Pelosi, the House Democratic leader, dismissed the Ryan proposal. "Sadly, beneath the sugary rhetoric of the poverty proposal unveiled today, Republicans are advancing the same callous, trickle-down policies they've been pushing for years," she said.

Linda Sánchez, a Democratic representative from California, said: "Today, House Republicans released their poverty plan called 'A Better Way', but their 'better way' is really just a reheated mess of the same old Republican ideology. Consolidating and streamlining critical anti-poverty programs is an insincere way of disguising Republicans' true intentions: sweeping cuts to vital programs through the use of block grants. To block grant these programs that so many across the county, and in my district, depend on would result in literally taking food out of children's mouths."

The second part of the Republican agenda, on national security, will be released on Thursday. Initiatives on regulation, constitutional authority, healthcare and tax reform are expected in the coming weeks.

Reuters contributed to this report