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 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 becomes present in a second reactor; c) supplying nitrogen and/or phosphorus to the second reactor 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 (Pc/Ca) 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 becomes present in the first reactor; e) removing part of the treated wastewater from the first reactor during or after step a) and removing part of the PHA-loaded activated sludge during or after step a), and optionally removing part of the grown activated sludge during or after step c), wherein the activated sludge removed during or after step a) 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 and second reactor together is less than 72 h. a) supplying a stream of the wastewater to 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 becomes present in a second reactor; c) supplying nitrogen and/or phosphorus to the second reactor 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 (Pc/Ca) 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 becomes present in the first reactor; e) removing part of the treated wastewater from the first reactor during or after step a) and removing part of the PHA-loaded activated sludge during or after step a), and optionally removing part of the grown activated sludge during or after step c), wherein the activated sludge removed during or after step a) 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 and second reactor together is less than 72 h.