WASHINGTON — White House press secretary Jay Carney became the news instead of just delivering it Friday, when President Obama unexpectedly interrupted the daily media briefing to announce Carney’s resignation after three and a half years as his primary spokesman.

Obama said it was “bittersweet” to see his friend Carney step down and announced that principal deputy press secretary Josh Earnest will take over the job. Carney said the transition will take place around mid-June, but Earnest will take his place traveling next week on Obama’s trip to Europe.

Carney brought rare but practical experience to the job as a former reporter who once covered the White House for Time magazine. He left journalism to become communications director for Vice President Joe Biden and subsequently moved over to serve as Obama’s press secretary in 2011.

“He comes to this place with a reporter’s perspective,” Obama told reporters after interrupting Carney midsentence as he responded to a question on Ukraine in the Brady Press Briefing Room. “That’s why, believe it or not, I think he will miss hanging out with you.”

A key component of a White House press secretary’s job is to regularly joust with reporters in an intense question-and-answer session. Obama said he is putting the “flak jacket” for dealing with the press on another friend in Earnest, who has worked with Obama since he was his communications director for the Iowa caucuses in the 2008 campaign.

The affable Earnest is well-liked within the White House press corps, and is seen as helpful. Reporters applauded the announcement. Earnest is a native of Kansas City, Missouri, and Obama noted he still roots for the hometown baseball team, the Royals, as the son of an athletic coach.

“As you know, his name describes his demeanor,” Obama said.