The San Francisco 49ers have agreed to a three-year, $28.5 million deal with safety Jimmie Ward, according to a league source.

He hoped to re-sign with the 49ers, but was unsure how the offseason would unfold.

Ward, who turns 29 in July, started all 13 games in which he appeared last season, finishing with 60 tackles, 1 sack and 8 passes defended. Then he had 13 tackles and a forced fumble in three playoff starts.