This paper presents a new power controller for inverter-based renewable power generators, which is based on direct power control of active and reactive power. The controller included fast PLL and ROCOF units in order to function in both grid-connection and islanding operations. The controller's performance was tested by detailed computer simulation of a 2MVA renewable power generator with a DC-link energy storage bank. Application tests were carried out within a 20kV primary feeder in parallel with a 0.91MVA diesel generator for different control-modes, in both grid-connection and intentional islanding operations. Transient performance tests, when transferring from grid-connection to islanding and back to grid-connection, demonstrated a seamless effect of control-mode transfer on the distribution network.