We developed a scan mirror mechanism (SMM) that enable a slit-based spectrometer or spectropolarimeter to precisely and quickly map an astronomical object. The SMM, designed to be installed in the optical path preceding the entrance slit, tilts a folding mirror and then moves the reflected image laterally on the slit plane, thereby feeding a different one-dimensional image to be dispersed by the spectroscopic equipment. In general, the SMM is required to scan quickly and broadly while precisely placing the slit position across the field-of-view (FOV). These performances are highly in demand for near-future observations, such as studies on the magnetohydrodynamics of the photosphere and the chromosphere. Our SMM implements a closed-loop control system by installing electromagnetic actuators and gap-based capacitance sensors. Our optical test measurements confirmed that the SMM fulfils the following performance criteria: i) supreme scan-step uniformity (linearity of 0.08%) across the wide scan range (±1005"), ii) high stability (3σ = 0.1"), where the angles are expressed in mechanical angle, and iii) fast stepping speed (26ms). The excellent capability of the SMM will be demonstrated soon in actual use by installing the mechanism for a near-infrared spectropolarimeter onboard the balloon-borne solar observatory for the third launch, Sunrise III.