Let $M$ be a smooth Riemannian manifold without boundary. Let $X\subset M$ be a closed subset which is a smooth submanifold with boundary, $\dim X=\dim M$. Assume that $X$ is locally convex, i.e. any point of $X$ has a neighborhood $U$ such that for any two points from $X\cap U$ there exists a unique shortest geodesic in $M$ connecting them, and this geodesic is contained in $X\cap U$.
Question. Let $p\in \partial X$. Let $\gamma$ be a geodesic in $M$ such that $\gamma(0)=p$ and $\gamma'(0)$ is tangent to $\partial X$. Is it true that there exists an open (in $M$) neighborhood $V$ of $p$ such that $\gamma \cap V$ does not intersect the interior of $X$?
Remark. If $M$ is a Euclidean space then the statement is true and it can be deduced e.g. from a version of the Hahn-Banach theorem.
A reference would be helpful.