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, the opening/closing mechanism is configured to freely expand and contract between an inner peripheral wall and an outer peripheral wall of the ring groove, the opening/closing mechanism is constituted by a seal ring including: an outer peripheral sealing surface that seals a gap between the back pressure space and the fluid passage when the seal ring is at an expanded position at which the seal ring is in contact with the outer peripheral wall; and an inner peripheral sealing surface that seals a gap between the high-pressure space and the fluid passage when the seal ring is at a contracted position at which the seal ring is in contact with the inner peripheral wall, and a communication part allowing the high-pressure space and the fluid passage whose gap is sealed by the inner peripheral sealing surface to communicate with each other is provided in a surface of the seal ring at the contracted position that is in contact with the inner peripheral wall. 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, the opening/closing mechanism is configured to freely expand and contract between an inner peripheral wall and an outer peripheral wall of the ring groove, the opening/closing mechanism is constituted by a seal ring including: an outer peripheral sealing surface that seals a gap between the back pressure space and the fluid passage when the seal ring is at an expanded position at which the seal ring is in contact with the outer peripheral wall; and an inner peripheral sealing surface that seals a gap between the high-pressure space and the fluid passage when the seal ring is at a contracted position at which the seal ring is in contact with the inner peripheral wall, and a communication part allowing the high-pressure space and the fluid passage whose gap is sealed by the inner peripheral sealing surface to communicate with each other is provided in a surface of the seal ring at the contracted position that is in contact with the inner peripheral wall.