A cyclic process for producing polyhydroxyalkanoate from wastewater comprising Readily Biodegradable COD (RBCOD) using activated sludge comprising bacteria capable of accumulating PHA, comprising the following steps: a) supplying a stream of the wastewater to a first reactor stage in a first reactor and contacting the wastewater with the activated sludge transferred from step d under PHA-accumulating conditions during a first period of time, the PHA-accumulating conditions comprising the presence of dissolved oxygen, wherein the wastewater supplied has a weight ratio of nitrogen to RBCOD-carbon on element basis (N a /C a) of below 1/25, and/or a weight ratio of phosphorus to RBCOD-carbon on element basis (P a /C a) of below 1/125, to obtain PHA-loaded activated sludge, and treated wastewater; b) providing that at least part of the PHA-loaded activated sludge and at least part of the treated wastewater obtained in the first reactor stage become present in a second reactor stage in the first reactor; c) supplying nitrogen and/or phosphorus to the second reactor stage and contacting the wastewater with the activated sludge under growth conditions during a second period of time, the growth conditions comprising the presence of dissolved oxygen, wherein the weight ratio, on element basis, of the amount of nitrogen or phosphorus supplied in step c) together with any dissolved amount of nitrogen and phosphorus, respectively, supplied with the wastewater in step a), to the amount of RBCOD-carbon supplied in step a) for nitrogen (N c /C a) is between 1/20 and 1/100, and/or for phosphorus (P c /C a) is between 1/100 and 1/500, to obtain grown activated sludge comprising residual PHA; d) providing that at least part of the grown activated sludge produced in the second reactor stage becomes present in the first reactor stage; e) removing part of the treated wastewater from the first reactor during or after step a) and/or during or after step c) and removing part of the PHA-loaded activated sludge during or after step a) and/or part of the grown activated sludge during or after step c), wherein the activated sludge removed comprises PHA at a level of at least 60 wt.% based on dry weight of the organic part of the sludge, and wherein the removed parts are such that the average retention time of the activated sludge in the first reactor is less than 72 h. a) supplying a stream of the wastewater to a first reactor stage in a first reactor and contacting the wastewater with the activated sludge transferred from step d under PHA-accumulating conditions during a first period of time, the PHA-accumulating conditions comprising the presence of dissolved oxygen, wherein the wastewater supplied has a weight ratio of nitrogen to RBCOD-carbon on element basis (N a /C a) of below 1/25, and/or a weight ratio of phosphorus to RBCOD-carbon on element basis (P a /C a) of below 1/125, to obtain PHA-loaded activated sludge, and treated wastewater; b) providing that at least part of the PHA-loaded activated sludge and at least part of the treated wastewater obtained in the first reactor stage become present in a second reactor stage in the first reactor; c) supplying nitrogen and/or phosphorus to the second reactor stage and contacting the wastewater with the activated sludge under growth conditions during a second period of time, the growth conditions comprising the presence of dissolved oxygen, wherein the weight ratio, on element basis, of the amount of nitrogen or phosphorus supplied in step c) together with any dissolved amount of nitrogen and phosphorus, respectively, supplied with the wastewater in step a), to the amount of RBCOD-carbon supplied in step a) for nitrogen (N c /C a) is between 1/20 and 1/100, and/or for phosphorus (P c /C a) is between 1/100 and 1/500, to obtain grown activated sludge comprising residual PHA; wherein the weight ratio, on element basis, of the amount of nitrogen or phosphorus supplied in step c) together with any dissolved amount of nitrogen and phosphorus, respectively, supplied with the wastewater in step a), to the amount of RBCOD-carbon supplied in step a) for nitrogen (N c /C a) is between 1/20 and 1/100, and/or for phosphorus (P c /C a) is between 1/100 and 1/500, to obtain grown activated sludge comprising residual PHA; d) providing that at least part of the grown activated sludge produced in the second reactor stage becomes present in the first reactor stage; e) removing part of the treated wastewater from the first reactor during or after step a) and/or during or after step c) and removing part of the PHA-loaded activated sludge during or after step a) and/or part of the grown activated sludge during or after step c),