Thank you for your service… don’t let the door hit you in the butt on the way out.

WASHINGTON — Speaker John A. Boehner, under intense pressure from conservatives in his party, will resign one of the most powerful positions in government and give up his House seat at the end of October, throwing Congress into chaos as it tries to avert a government shutdown.

Mr. Boehner, who was first elected to Congress in 1990, made the announcement in an emotional meeting with his fellow Republicans on Friday morning.

The Ohio representative struggled from almost the moment he took the speaker’s gavel in 2011 to manage the challenges of divided government and to hold together his fractious and increasingly conservative Republican members.