Boris Johnson has thrown down the gauntlet to his Conservative leadership rivals by insisting the UK must leave the EU by the end of October with or without a deal, as he set out a hardline Brexit stance just hours after Theresa May announced her resignation.

Johnson is the favourite among Conservative members to take over as prime minister by the last week of July, but he will face competition from as many as 20 rivals.

The foreign secretary, Jeremy Hunt, was the first cabinet minister to say he would stand, while Dominic Raab, the former Brexit secretary, said he would take time to think about it over the weekend. The environment secretary, Michael Gove, and the home secretary, Sajid Javid, are also expected to announce leadership bids in the coming days.

The work and pensions secretary, Amber Rudd, ruled herself out of the race in an interview with the Telegraph: She said: “I am conscious that the Conservative party wants to have someone who they believe is very enthusiastic about Brexit … I don’t think this is my time at the moment.” Despite her remainer credentials, she did hint that she could back Johnson’s bid, saying they had worked together in the past and got on “perfectly well”.

The contest is shaping up to be a test of where the candidates stand on Brexit, with Johnson taking a firm stance on leaving by the EU’s next deadline.

He told a conference in Interlaken, Switzerland: “We will leave the EU on 31 October, deal or no deal.”

He suggested he could try to renegotiate a better deal with Brussels before pressing ahead with the possibility of a no-deal Brexit if necessary. “A new leader will have the opportunity to do things differently and have the momentum of a new administration,” he said.

A supporter of Johnson said he would make an effort to secure changes to the current deal to try to ensure the Northern Ireland border backstop would not endure indefinitely, but he would press ahead with leaving on 31 October if that cannot be agreed with the EU27.

Raab, also a leave supporter, is attracting support from some Brexit hardliners in the party, which means Johnson will come under some pressure to demonstrate how prepared he is to leave without a deal.

Avowedly soft Brexit candidates, such as Rory Stewart, the international development secretary, will be keen to position themselves as the choice for those who oppose leaving without a withdrawal agreement.

But it leaves cabinet ministers such as Hunt, Gove, Javid and Matt Hancock, the health secretary, with a dilemma about how far they should go in opening the door to a no-deal Brexit, having advocated May’s deal as a better option.

The candidates have begun declaring their intent even though the leadership contest does not begin officially until 10 June, three days after May stands down as Tory leader. MPs will take part in several rounds of voting to whittle down the large field of about 20 to a shortlist of two by the end of the month.

One MP on the executive of the 1922 Committee, which organises the contest, said those with the fewest votes would face pressure to drop out quickly to avoid wasting time.

He predicted all but the top four to six would withdraw after the first round or two of voting. “MPs and the voluntary party all want this done as quickly as possible,” he said, dismissing any idea that May could stay on as a caretaker prime minister over the summer.

After the MPs choose their shortlist, the strongly Eurosceptic Tory party membership will vote to choose their leader, who will automatically become prime minister before parliament’s summer break. Recess dates have not yet been announced, but the Commons rose on 24 July last year.

Who should be the next Tory leader? Our panel responds | Polly Toynbee and others Read more

Johnson, a former foreign secretary and leading leave campaigner, will have James Wharton, a former MP, acting as his campaign manager. Jacob Rees-Mogg, the chair of the Eurosceptic European Research Group, is a key backer and there have been reports that the political strategist Lynton Crosby is providing informal advice.

Raab is backed by David Davis, the former Brexit secretary, and has assembled a campaign team advised by Hanbury Strategy’s Paul Stephenson, a former Vote Leave staff member.

The two men have attracted the most financial support in donations declared on the MPs’ register of interests in recent months, with Johnson amassing £130,000 and Raab £115,000.

Play Video 6:55 Prime minister Theresa May’s resignation speech in full – video

Andrea Leadsom, a leave supporter whose decision to quit as leader of the House of Commons helped trigger May’s departure, is another significant candidate on the Eurosceptic wing of the party. She was May’s adversary last time but dropped out of the race before the Conservative membership had a chance to vote.

Other hopefuls who sit in the cabinet include Penny Mordaunt, the defence secretary, and Liz Truss, the chief secretary to the Treasury.

An array of backbenchers and junior ministers also fancy their chances. James Cleverly, recently promoted to be a Brexit minister, is expected to throw his hat in the ring and Sir Graham Brady, who stood down on Friday as the chair of the 1922 Committee, is considering whether to stand despite having little name recognition outside Westminster. The former chief whip Mark Harper is also thought to be preparing a campaign.

From the hard-Brexit wing of the party, Esther McVey, the former work and pensions secretary, has declared she will run, while Steve Baker, one of the most vocal holdouts against May’s deal, has said he will consider whether to stand over the weekend.