The Man in the Iron Mask
(1998)

D'Artagnan (Gabriel Byrne) gets stabbed in the back when King Louis XIV (Leonardo DiCaprio) tries to kill Philippe (Leonardo DiCaprio) when his guards don't injure the charging Musketeers.

D'Artagnan and Queen Mother Anne (Anne Parillaud) were lovers and are still in love with the twins being the result but D'Artagnan didn't know about Philippe.  Louis gets placed in the mask and put in prison while Philippe takes the throne as Louis. 

Aramis (Jeremy Irons) has a voice over ending stating the man in the iron mask was released into the quiet country and visited often by the Queen.  Louis was a great king.
 

Thanks Ann-Marie 'crappy' F!