The New York Court of Appeals on Thursday unanimously reinstated two felony charges against a former high school volleyball coach in Queens who sexted with a female athlete in 2014.

The yearslong legal battle worked its way to the high court from a trial court and the Appellate Division, Second Department, centering on the authenticity of text messages obtained by a third party, the girl’s then-boyfriend.