Image copyright AFP Image caption Cantor said he wanted to ensure his constituents had a voice in the upcoming "lame-duck" session of Congress

The number-two leader in the US House of Representatives has said he will resign from Congress, weeks after his shock defeat in a party primary vote.

Majority Leader Eric Cantor of Virginia said he hoped his successor could take office in November rather than January.

The seven-term Republican congressman was defeated in June by Dave Brat, a conservative economics professor.

Mr Brat won despite raising less than $300,000 (£178,000) for his campaign to Mr Cantor's $5.4m.

He will now face Democratic nominee Jack Trammell - also a professor at Randolph-Macon College - in this autumn's general election.

'Privilege of a lifetime'

On Friday, Mr Cantor announced his plans to leave Congress on 18 August in a piece in the Richmond Times-Dispatch newspaper.

He said he had asked Virginia Governor Terry McAuliffe to call a special election for his seat on 4 November, the same day as the general election. A special election to fill the vacant seat would enable his successor, Republican or Democrat, to begin work immediately instead of having to wait to be sworn in with the rest of the new Congress in January 2015.

"I want to make sure that the constituents in the seventh district will have a voice in what will be a very consequential lame-duck session," the Republican congressman told the newspaper, referring to the period in November and December between the general election and the constitutionally mandated start of the new Congress.

Image copyright AP Image caption California Representative Kevin McCarthy is now the second most powerful House Republican

Mr Cantor, who was first elected in 2000, stepped down as majority leader in a speech on the floor of the House of Representatives on Thursday.

"This is a privilege of a lifetime," he said, thanking his fellow representatives, including House Speaker John Boehner, praising him for the "example of firm leadership".

California Representative Kevin McCarthy now replaces Mr Cantor as majority leader.