The literature on the Supreme Court has used static models of voting to estimate the policy preferences of justices that largely ignore the role of precedent, a dynamic component in justices' decision-making process that could help explain part of their voting behavior. I formulate and structurally estimate a dynamic game-theoretic model of decision-making on the U.S. Supreme Court that can infer the preferences of individual justices over ideology versus the weight they place on respecting precedent. I find that justices who experience a high cost of deviating from precedent are more ideological when their votes are likely to be pivotal. Taking the model to data, I find that precedent plays a sizable role in explaining justices' voting behaviors with significant heterogeneity across justices and legal issues. Moreover, incorporating precedent in the analysis changes the ideology estimates for about one-third of the justices in the sample. I use these estimates to simulate counterfactual outcomes for policy proposals, such as court-packing and judicial term limits.