A scroll compressor, comprising: a casing; a rotary compression mechanism housed in the casing, and including a compression chamber formed by engaging a fixed scroll and an orbiting scroll with each other; a discharge port located in the compression mechanism and being open at a discharge position of the compression chamber; an intermediate port located in the compression mechanism and being open at an intermediate position of the compression chamber; a forming member located in the casing and including a back pressure space and at least part of a fluid passage, the back pressure space facing a back surface of the orbiting scroll and communicating with the intermediate port, the fluid passage allowing a high-pressure space communicating with the discharge port and the back pressure space to communicate with each other; and an opening/closing mechanism configured to close the fluid passage when a pressure of the back pressure space is lower than that of the high-pressure space, and open the fluid passage when the pressure of the back pressure space is higher than that of the high-pressure space, wherein the opening/closing mechanism is held by a ring groove that is open to the fluid passage of the forming member, and the opening/closing mechanism is constituted by a seal ring configured to freely expand and contract between an expanded position at which the seal ring is in contact with an outer peripheral wall of the ring groove to seal a gap between the back pressure space and the fluid passage and a contracted position at which the seal ring is separated from both of an inner peripheral wall and the outer peripheral wall of the ring groove to open the fluid passage. a casing; a rotary compression mechanism housed in the casing, and including a compression chamber formed by engaging a fixed scroll and an orbiting scroll with each other; a discharge port located in the compression mechanism and being open at a discharge position of the compression chamber; an intermediate port located in the compression mechanism and being open at an intermediate position of the compression chamber; a forming member located in the casing and including a back pressure space and at least part of a fluid passage, the back pressure space facing a back surface of the orbiting scroll and communicating with the intermediate port, the fluid passage allowing a high-pressure space communicating with the discharge port and the back pressure space to communicate with each other; and an opening/closing mechanism configured to close the fluid passage when a pressure of the back pressure space is lower than that of the high-pressure space, and open the fluid passage when the pressure of the back pressure space is higher than that of the high-pressure space, wherein the opening/closing mechanism is held by a ring groove that is open to the fluid passage of the forming member, and the opening/closing mechanism is constituted by a seal ring configured to freely expand and contract between an expanded position at which the seal ring is in contact with an outer peripheral wall of the ring groove to seal a gap between the back pressure space and the fluid passage and a contracted position at which the seal ring is separated from both of an inner peripheral wall and the outer peripheral wall of the ring groove to open the fluid passage.