A direct search for Higgs bosons that are produced via vector boson fusion and subsequently decay into invisible particles is reported.The analysis uses 139 fb of collision data at = 13 TeV recorded by the ATLAS detector at the LHC. The observed number of events are found to be in agreement with the background expectation from Standard Model processes. Assuming a 125 GeV scalar Higgs boson with a Standard Model production cross section, both the observed and expected upper limits on the branching fraction of its decay into invisible particles are derived to be 0.13 at 95 confidence level. These results are also interpreted in the context of models where the 125 GeV Higgs boson acts as a portal to dark matter, and limits are set on the scattering cross-section of weakly interacting massive particles and nucleons. The invisible decays of additional scalar bosons with masses from 50 GeV up to 1 TeV are also studied, and upper limits on the cross section times branching fraction are evaluated to be 0.97 pb for a scalar boson mass of 50 GeV, which falls with increasing mass to become 0.12 pb at a mass of 1 TeV.