A rigid, rod-shaped endoscope for medical applications includes a distal end having a light-permeable distal window and a light outlet disposed adjacent to the distal window, which includes a device configured to prevent the incidence of stray light onto sides of the deflection prism facing the distal window. An endoscope shank includes a plurality of telescoping hollow tubes. An inner fixed optical tube includes a moveable optical deflection prism and an optical system configured to transmit light beams. The optical deflection prism is mounted rotatably on a shaft that is disposed at a right angle to a longitudinal axis of the endoscope. At least one moveable sliding tube is configured to move relative to the inner fixed optical tube in the direction of the longitudinal axis of the endoscope using magnetic forces generated by a plurality of moveable permanent magnets.