On page 201 of Farb and Margalit's *Primer on Mapping Class Groups*, they explain why the mapping class group $\mathrm{Mod}(S)$ is torsion-free when $\partial S \neq \varnothing$. Here is my understanding of the argument:

Let $S$ be a surface with a hyperbolic metric and let $\phi\colon S \to S$ be an isometry fixing $\partial S$ pointwise. Then $\phi$ fixes a frame (a basis for the tangent space) at every point of $\partial S$. Since isometries of surfaces are determined by their action on a frame, we must have that $\phi = \mathrm{id}$.

The Nielsen realization theorem (Theorem 7.1) states that for every order $k < \infty$ element $f \in \mathrm{Mod}(S)$, there is an isometry $\phi \in \mathrm{Homeo}^+(S)$ of order $k$ representing $f$. However, there is no guarantee that $\phi$ will fix the boundary, we only know that $\phi$ is in the free homotopy class $f$. Up to here I understand all the points that have been made.

What I don't understand is how they go from this, and the fact that Dehn twists about boundary components have infinite order, to conclude that $\mathrm{Mod}(S)$ is torsion-free whenever $\partial S \neq 0$. Is the point that if $f$ is a torsion element, then the isometry representative $\phi$ given by the NIelsen realization theorem must fix the boundary pointwise and therefore be the identity? I don't know how you would show this. I also don't understand why Dehn twists entered the argument.