A barrel nut is disclosed. The barrel nut contains an internal thread configured to engage a portion of lower receiver, a plurality of longitudinally-extending splines formed along an outer surface of the barrel nut, a plurality of longitudinally-extending channels formed along an outer surface of the barrel nut, wherein the splines and the channels operate to engage one or more protrusions of a handguard assembly and prevent rotation of the handguard assembly.