The San Francisco 49ers have finally agreed to a new long-term deal with veteran kicker Robbie Gould.

Per Adam Schefter of ESPN, Gould has come to terms on a two-year, $10.5 million fully-guaranteed deal which includes an option that could make it a four-year, $19 million pact with $15 million guaranteed.

The 49ers had placed the franchise tag on Gould and had until today, July 15, to come to an agreement on a long-term contract.

However, the 36-year-old Gould had not yet even signed his franchise tender after he requested a trade from San Francisco earlier this offseason due to his desire to be closer to his children in Chicago.

He also said recently that he wouldn’t commit to reporting with the 49ers under the tag. But it seems the two sides have come to an agreement just in time.

Gould has spent the last two seasons with the 49ers, which have been two of the best of his career. He's made 72 out of 75 field-goal attempts (96 percent) and 55 of 59 extra points in 32 games.

Prior to his arrival in San Francisco, Gould spent one season with the New York Giants, making 10 out of 10 field goals in 10 games.

And before that, he had spent his first 11 seasons in the NFL with the Chicago Bears. He made First-Team All-Pro in 2006 and ended his career in Chicago as the franchise's all-time leader in points and field goals made.

Gould is also second all-time behind only the Baltimore Ravens' Justin Tucker in terms of the highest career field-goal accuracy at 87.75%.