This paper deals with the development of a control technique for the control of voltage source converters (VSCs) as an interface between renewable energy sources (RESs) and power grids. The lack of inertia in converter-based generators and their unconventional dynamic behavior increase the negative impacts on the power grid, unlike the operation of the conventional synchronous generators (SGs). In this sense, the proposed control technique emulates the behavior of SGs in the control loop of the interfaced converter acting as a grid-forming power generator. Thus, supportive functionalities for enhancing electric grid stability (e.g., frequency oscillation damping) will be provided by interfaced converter as a virtual synchronous generator (VSG). The main targets of the proposed control technique include virtual inertia emulation, frequency oscillation damping, primary and secondary frequency regulation, and voltage regulation. The main contribution of this work over the existing methods is that the optimal values for swing equation parameters are employed to ensure well-designed damping feature of the VSG-based converter which adapts grid-connected and islanded operating modes, enabling a smooth resynchronizing to the grid as its plug-and-play capability requirement. The control structure is evaluated through simulation in MATLAB/Simulink.