By Len Ramirez

SAN JOSE (KPIX 5) — Years of fighting between the city and its police force may be ending. A tentative labor agreement gives officers cash bonuses and a 20 percent pay raise over the next three years.

San Jose Mayor Sam Liccardo said, “We’re able now to really begin to rebuild.  For the last few years, it’s really been about stemming the bleeding. At this point now, we’re able to welcome home a lot of officers who have been asking hey when is the contract going to be done?”

READ MORE: 49ers Playoffs: Die-Hard Fans Offer Sendoff, Head To Frigid Green Bay For Showdown Vs. Packers

San Jose has lost over 500 officers since 2012. Basic patrol shifts had to be filled with cops working overtime.

Some officers camped in RV’s in the parking lot because they were too tired to drive home and back again on short turnaround.

The new contract puts San Jose cops ahead of San Francisco and Oakland in total cash compensation.

Top tier officers will make almost $153,000 a year.

READ MORE: Livemore Man Arrested in Series of Sexual Battery Attacks on Female Joggers

Paul Kelly with the San Jose Police Officers Association said, “We’re competitive! Hopefully the retirements and resignations will stop or slow down and we’re able to fill that academy. That’s number one. That’s what this was about, being able to rebuild our police department.”

Liccardo says the city has structured the deal to avoid long term financial trouble and he says the city was able to get some of what it wanted to fight crime better. Officers on beat assignments in high crime areas will now have to wait a year before they can transfer out, instead of 6 months, which can help build trust and continuity with the community.

Officers would also get a one- time retention bonus of five thousand dollars.

And mandatory overtime would be phased out as the department hires new officers.

MORE NEWS: A's Stadium Environmental Impact Report Clears Oakland Planning Commission, City Council Next

This isn’t a done deal yet. The union will be voting to ratify the agreement over the next couple of weeks.