A method for forming a gate (1, 2) of an enhancement-mode transistor, the method comprising the steps of: a. providing a p-doped Al x Ga y In z N gate layer, consisting of a first part and a second part on top of one another, above an Al x" Ga y" In z" N barrier layer itself on a Al x' Ga y' In z' N channel layer of an enhancement-mode transistor under construction wherein x+y+z is 1, wherein x'+y'+z' is 1, wherein x"+y"+z" is 1, wherein x<x">x', and wherein the barrier layer has a larger band gap than the channel layer, and b. providing a metal gate layer in physical contact with the top surface of the second part of the p-doped Al x Ga y In z N gate layer, the metal gate layer being formed of a material such as to form a Schottky barrier with the second part of the p-doped Al x Ga y In z N gate layer, wherein providing the p-doped Al x Ga y In z N gate layer comprises the steps of: a1. growing the first part of the p-doped Al x Ga y In z N gate layer until the first part reaches a thickness of at least 3 nm, above the Al x' Ga y' In z' N channel layer of the enhancement-mode transistor under construction, the first part having an average Mg concentration higher than 0.5×10 19 atoms/cm 3 and at most 3×10 19 atoms/cm 3, and a2. growing the second part of the p-doped Al x Ga y In z N gate layer on the first part of the p-doped Al x Ga y In z N gate layer, wherein the second part has an average Mg concentration higher than 3×10 19 atoms/cm 3, has a top surface having a Mg concentration higher than 6x10 19 atoms/cm 3, and has an Mg concentration at a bottom of the second part which is higher than the Mg concentration at a top of the first part, wherein step a is performed in a deposition chamber and step a2 comprises: (i) stopping the growth of the first part, then (ii) providing the chamber with a flow of a Mg precursor gas, and - no flow of Ga, In, and Al precursor gases, and/or - no flow of N precursor gas, then (iii) without flushing the chamber from the Mg precursor contained therein, providing the chamber with a flow of a Mg precursor gas, a flow of one or more precursor gases selected from Ga, In, and Al precursor gases and a flow of an N precursor gas so as to grow the second part. a. providing a p-doped Al x Ga y In z N gate layer, consisting of a first part and a second part on top of one another, above an Al x" Ga y" In z" N barrier layer itself on a Al x' Ga y' In z' N channel layer of an enhancement-mode transistor under construction wherein x+y+z is 1, wherein x'+y'+z' is 1, wherein x"+y"+z" is 1, wherein x<x">x', and wherein the barrier layer has a larger band gap than the channel layer, and b. providing a metal gate layer in physical contact with the top surface of the second part of the p-doped Al x Ga y In z N gate layer, the metal gate layer being formed of a material such as to form a Schottky barrier with the second part of the p-doped Al x Ga y In z N gate layer, wherein providing the p-doped Al x Ga y In z N gate layer comprises the steps of: a1. growing the first part of the p-doped Al x Ga y In z N gate layer until the first part reaches a thickness of at least 3 nm, above the Al x' Ga y' In z' N channel layer of the enhancement-mode transistor under construction, the first part having an average Mg concentration higher than 0.5×10 19 atoms/cm 3 and at most 3×10 19 atoms/cm 3, and a2. growing the second part of the p-doped Al x Ga y In z N gate layer on the first part of the p-doped Al x Ga y In z N gate layer, wherein the second part has an average Mg concentration higher than 3×10 19 atoms/cm 3, has a top surface having a Mg concentration higher than 6x10 19 atoms/cm 3, and has an Mg concentration at a bottom of the second part which is higher than the Mg concentration at a top of the first part, a1. growing the first part of the p-doped Al x Ga y In z N gate layer until the first part reaches a thickness of at least 3 nm, above the Al x' Ga y' In z' N channel layer of the enhancement-mode transistor under construction, the first part having an average Mg concentration higher than 0.5×10 19 atoms/cm 3 and at most 3×10 19 atoms/cm 3, and a2. growing the second part of the p-doped Al x Ga y In z N gate layer on the first part of the p-doped Al x Ga y In z N gate layer, wherein the second part has an average Mg concentration higher than 3×10 19 atoms/cm 3, has a top surface having a Mg concentration higher than 6x10 19 atoms/cm 3, and has an Mg concentration at a bottom of the second part which is higher than the Mg concentration at a top of the first part, wherein step a is performed in a deposition chamber and step a2 comprises: (i) stopping the growth of the first part, then (ii) providing the chamber with a flow of a Mg precursor gas, and - no flow of Ga, In, and Al precursor gases, and/or - no flow of N precursor gas, then (iii) without flushing the chamber from the Mg precursor contained therein, providing the chamber with a flow of a Mg precursor gas, a flow of one or more precursor gases selected from Ga, In, and Al precursor gases and a flow of an N precursor gas so as to grow the second part. (i) stopping the growth of the first part, then (ii) providing the chamber with a flow of a Mg precursor gas, and - no flow of Ga, In, and Al precursor gases, and/or - no flow of N precursor gas, then - no flow of Ga, In, and Al precursor gases, and/or - no flow of N precursor gas, then (iii) without flushing the chamber from the Mg precursor contained therein, providing the chamber with a flow of a Mg precursor gas, a flow of one or more precursor gases selected from Ga, In, and Al precursor gases and a flow of an N precursor gas so as to grow the second part.