The present invention relates to a device functioning as an electric motor or actuator (100, 100′) comprising: a housing (110) encapsulating a rotating member (120, 120′), one or several arrangements (130, 130′) for generating a magnetic field due to electrical current, a displaceable shaft (140, 140′) at least partly having exterior grooves (141, 141′), said rotating member having a portion (121, 121′) with inner grooves (122, 122′) corresponding to grooves on said shaft (140, 140′). The device comprises at least one magnetic element (150, 150′) arranged on an outer surface of said rotating member (120, 120′) substantially perpendicular to extension direction of said grooves (122, 122′) for interaction with said arrangement (130, 130′) and rotating said rotating member.