(1) The state, local governmental entities, any public or private agency, and the employees of any state or local governmental entity or public or private agency, acting in good faith, are immune from liability:
(a) For failure to prevent the sale or transfer of a firearm to a person whose receipt or possession of the firearm is unlawful;
(b) For preventing the sale or transfer of a firearm to a person who may lawfully receive or possess a firearm;
(c) For issuing a concealed pistol license or alien firearm license to a person ineligible for such a license;
(d) For failing to issue a concealed pistol license or alien firearm license to a person eligible for such a license;
(e) For revoking or failing to revoke an issued concealed pistol license or alien firearm license;
(f) For errors in preparing or transmitting information as part of determining a person's eligibility to receive or possess a firearm, or eligibility for a concealed pistol license or alien firearm license;
(g) For issuing a dealer's license to a person ineligible for such a license; or
(h) For failing to issue a dealer's license to a person eligible for such a license.
(2) An application may be made to a court of competent jurisdiction for a writ of mandamus:
(a) Directing an issuing agency to issue a concealed pistol license or alien firearm license wrongfully refused;
(b) Directing the Washington state patrol firearms background check program to approve an application to purchase a firearm wrongfully denied;
(c) Directing that erroneous information resulting either in the wrongful refusal to issue a concealed pistol license or alien firearm license or in the wrongful denial of a purchase application for a firearm be corrected; or
(d) Directing a law enforcement agency to approve a dealer's license wrongfully denied.
The application for the writ may be made in the county in which the application for a concealed pistol license or alien firearm license or an application to purchase a firearm was made, or in Thurston county, at the discretion of the petitioner. A court shall provide an expedited hearing for an application brought under this subsection (2) for a writ of mandamus. A person granted a writ of mandamus under this subsection (2) shall be awarded reasonable attorneys' fees and costs.