Filter for filtering fluids, in particular fuel or oil, in particular of a motor vehicle, comprising a filter housing made of at least two housing components (14, 16; 514), and a filter element (18; 518) which is attached by means of a detachable locking connection in one of the housing components and which acts as fastening housing part (14; 14) for the filter element (18; 518), wherein the locking connection features at least two interacting detent members (32, 36), and one of the detent members is connected to the filter element (18; 518) and one of the detent members to the fastening housing part (14; 514), and at least one of the detent members comprises at least one latching means and one of the detent members comprises a recess corresponding with the latching means in which the latching means engages in a bayonet-like manner, and the recess features the following areas: a closing area for receiving the latching means during the connection of the housing components (14, 16; 514), a retaining area for receiving the latching means during the opening of the filter housing, a translation area for detaching the latching means in the recess and an insertion/removal area for joining and separating latching means and recess without resistance, characterized in that the filter features a switching device (58; 518) comprising at least two corresponding switching components (60, 78; 560), wherein one of the switching components (60; 560) is connected to the filter element (18; 518) and one of the switching components (62; 562) to the fastening housing part (14; 514), and one of the switching components (60; 560) comprises at least one switching nose (76; 576) extending radially relative to a rotational/plug-in axis (30; 530) of the filter and one of the switching components (62; 562) comprises a shifting gate (78; 578) for guiding the switching nose (76; 576) in such a way that the shifting gate (78; 578), in case of an axial movement in a pulsed manner of the filter element (18; 518) relative to the fastening housing part (14; 514), guides the switching nose (76; 576) and thus causes a rotating movement of the filter element (18; 518) relative to the fastening housing part (14; 114) around the rotational/plug-in axis (30; 530) for relocating the latching means from the insertion/removal area into the closing area or from the retaining area into the insertion/removal area, depending on the position of the latching means in the recess before the action of the axial movement. wherein the switching device (58; 558) features at least one resilient element, in particular a spiral compression spring (84; 584) for realizing a pretension between the fastening housing part (14; 514) and the filter element (18; 518). a closing area for receiving the latching means during the connection of the housing components (14, 16; 514), a retaining area for receiving the latching means during the opening of the filter housing, a translation area for detaching the latching means in the recess and an insertion/removal area for joining and separating latching means and recess without resistance, characterized in that the filter features a switching device (58; 518) comprising at least two corresponding switching components (60, 78; 560), wherein one of the switching components (60; 560) is connected to the filter element (18; 518) and one of the switching components (62; 562) to the fastening housing part (14; 514), and one of the switching components (60; 560) comprises at least one switching nose (76; 576) extending radially relative to a rotational/plug-in axis (30; 530) of the filter and one of the switching components (62; 562) comprises a shifting gate (78; 578) for guiding the switching nose (76; 576) in such a way that the shifting gate (78; 578), in case of an axial movement in a pulsed manner of the filter element (18; 518) relative to the fastening housing part (14; 514), guides the switching nose (76; 576) and thus causes a rotating movement of the filter element (18; 518) relative to the fastening housing part (14; 114) around the rotational/plug-in axis (30; 530) for relocating the latching means from the insertion/removal area into the closing area or from the retaining area into the insertion/removal area, depending on the position of the latching means in the recess before the action of the axial movement. wherein the switching device (58; 558) features at least one resilient element, in particular a spiral compression spring (84; 584) for realizing a pretension between the fastening housing part (14; 514) and the filter element (18; 518).