Faced with falling morale, increasing retirements and a shortage of new agents, U.S. Customs and Border Protection on Wednesday announced a 5 percent bonus for agents willing to stay with the agency another year.

The retention bonus is meant to stop an exodus of experienced agents just as the border patrol is seeing a surge in illegal immigrants higher than any time in the last 12 years.

In the first six months of the fiscal year, the agency apprehended 361,000 migrants, twice as many as the same period last year. More than 62 percent were families or unaccompanied minors from Central America.

The bonus will cost taxpayers $84 million but will come out of the existing CBP budget. It applies to more experienced supervisory agents with typically at least seven years on the job earning around $100,000.

The roughly $5,000 bonus will be paid out in four quarterly increments, meaning agents will receive four $1,250 payments over a one-year period.

HEAVILY ARMED MEN ESCORT MIGRANTS ACROSS US BORDER, SURVEILLANCE VIDEO SHOWS

"This is one way of expressing appreciation for agents who are the backbone of our operations," a CBP official told Fox News during a briefing on the new plan. "We need them to get through this crisis."

The border patrol currently has 19,484 agents, down from a high of 21,444 in 2011. Right now, however, agents are retiring faster than the agency can hire new agents, with the attrition rate 38 percent higher than last year.

FORMER ICE ACTING DIRECTOR TOM HOMAN SAYS BORDER CRISIS IS THE WORST HE'S EVER SEEN

The retention bonus is the first of several steps the agency is taking to attract and keep agents. Later this year, officials plan to announce an incentive plan to attract agents to hard-to-fill jobs in remote locations on the border where the climate is harsh and services are scant.

CLICK HERE TO GET THE FOX NEWS APP

“Investing in the men and women of the United States Border Patrol continues to be my top priority,” Carla Provost, U.S. Border Patrol Chief, said in a statement. “Their experience and expertise is critical to successfully accomplishing the border security mission.”