
416 A.2d 690 (1980)
Rena L. WOOD
v.
Gary LUSSIER, Individually and in his capacity as Building Inspector of the Town of Exeter.
No. 78-345-Appeal.
Supreme Court of Rhode Island.
July 7, 1980.
*692 Hogan & Hogan, Donald J. Packer, Providence, for plaintiff.
Brosco & Brosco, Anthony J. Brosco, Howard A. Salk, Providence, for defendant.

OPINION
BEVILACQUA, Chief Justice.
The plaintiff filed a petition in the Superior Court seeking a writ of mandamus to compel the defendant, individually and in his capacity as the Exeter Building Inspector, to issue a building permit to the plaintiff. The defendant appeals from a judgment directing such writ to issue.
On or about October 20, 1976, Rena L. Wood (plaintiff), attempted to obtain from Gary Lussier (defendant), who was then the Exeter Building Inspector, a building permit to construct an apartment house on certain land owned by her in Exeter. At that time defendant refused to supply plaintiff with the prescribed application form but instead referred her to the Exeter Planning Board. On December 13, 1976, apparently frustrated by her dealings with the planning board, plaintiff filed her petition for mandamus in the Superior Court.
At the hearing, before a justice of the Superior Court, neither party testified, but the parties introduced exhibits and presented arguments.
After hearing and due consideration, the trial justice entered judgment granting plaintiff's petition and directing that a writ of mandamus be rendered requiring defendant to issue a building permit to plaintiff.

I
On appeal defendant contends that the trial justice erred as a matter of law in granting plaintiff's petition for mandamus. The defendant argues that plaintiff's petition for mandamus was premature and, therefore, improperly before the trial court because she had not exhausted administrative remedies available to her at the time she instituted mandamus proceedings.
We do not dispute the well-settled principle of law that mandamus does not lie if the party seeking the writ has not exhausted an administrative remedy that is available for obtaining the same relief; but the existence of a legal remedy other than mandamus does not necessarily mean that mandamus will not lie. If the remedy provided is one that is not plain, speedy, and adequate, mandamus may lie. Marran v. West Warwick School Committee, 113 R.I. 42, 44, 317 A.2d 455, 456 (1974); Warren Education Association v. Lapan, 103 R.I. 163, 174-75, 235 A.2d 866, 873 (1967). The question of what constitutes a plain, speedy, and adequate remedy must be considered in the circumstances of each case. Id. at 175, 235 A.2d at 873.
The defendant asserts here that plaintiff failed to exhaust administrative remedies available to her under the provisions of the state building code, G.L. 1956 (1979 Reenactment) chapter 27.2 of title 23.
Under G.L. 1956 (1968 Reenactment) chapter 27 of title 23 (repealed 1976), the Legislature delegated to the town and city councils the authority to regulate the manner of constructing all buildings within their respective towns and cities and to appoint an inspector of buildings and define his duties in the administration and enforcement of the local building ordinances and regulations. About 1973, however, the Legislature undertook to enact a state building code that would promote uniformity in this area and to some extent thereby preempt local authority. Nevertheless, the effective date of the state building code, including its administrative appeals provisions, was July 1, 1977; until that time local law remained in effect. General Laws 1956 (1979 Reenactment) § 23-27.2-10, as amended by P.L. 1979, ch. 148, § 1. We *693 turn, therefore, to ascertain the administrative remedies, if any, available to plaintiff under the Exeter Building Ordinance[1] (the building ordinance) in effect at the time she filed her petition for mandamus.
The pertinent provisions of the building ordinance appeared in § 5 thereof. Section 5 constituted the Exeter Town Council as "the board of appeal from the Inspector of Buildings * * *" and then described generally the appeals procedure. Apparently, plaintiff did not prosecute a § 5 appeal before seeking mandamus. This defect is inconsequential, however, because we find that on the facts before us plaintiff did not have a plain, speedy, and adequate remedy under § 5.
Section 2 of the building ordinance provided, inter alia, that "[a]ny person * * contemplating the erection * * * of a structure * * * shall make application for a permit on the prescribed forms in the Office of the Building Inspector." Section 2 provided further that "[t]he denial * * of a building permit shall be made by the Building Inspector to the applicant in writing precisely stating the reasons for such action * * *." The defendant does not dispute that by virtue of these provisions he had a clear, legal, and ministerial duty to provide plaintiff, upon her request, with the prescribed application form and to review the completed application if it were properly submitted to him. By refusing to issue plaintiff the prescribed application form, defendant effectively nullified plaintiff's right to apply to his office for a building permit and to obtain review under § 5 of any denial by defendant of her application. See The Beacon Restaurant, Inc. v. Adamo, 103 R.I. 698, 704, 241 A.2d 291, 294 (1968). Cf. Bowes v. Inspector of Buildings of Brockton, 347 Mass. 295, 296, 197 N.E.2d 676, 677 (1964) (failure to provide written denial frustrated applicant's right to administrative appeal).

II
The defendant argues next that plaintiff was not entitled to the relief granted because his duty under the building ordinance to issue building permits is not merely ministerial but also involves his judgment and discretion, which may not be controlled or reviewed by way of mandamus.
We agree with defendant's contention that under the building ordinance his duties in regard to the issuance of building permits involved his judgment and discretion in the determination of whether an applicant's proposed construction was in conformity with its provisions. Section 2 provided that "[a]ny act of construction not in conformity with this ordinance * * * shall be cause for denial * * * of a building permit * * *." It also provided that "[t]he Building Inspector may require any additional information, maps and plans that he deems necessary in issuing a permit." Our agreement with defendant's instant contention does not, however, inevitably lead us to the conclusion that mandamus may not lie to compel defendant to issue a building permit.
The general rules governing the issuance of mandamus are applicable when the writ is sought to compel the granting of a building permit. See Illinois Mason Contractors, Inc. v. City of Wheaton, 19 Ill.2d 462, 167 N.E.2d 216 (1960); State ex rel. Killeen Realty Co. v. City of East Cleveland, 169 Ohio St. 375, 377-78, 160 N.E.2d 1, 3-4 (1959). The issuance of a writ of mandamus is discretionary, but this discretion must be exercised in accordance with well-settled principles. The writ ought to issue if "the petitioners have a clear legal right to have the act done which is sought by the writ; and where the respondents have a ministerial, legal duty to perform such act without discretion to refuse * * *." The Bionomic Church of Rhode Island v. Gerardi, R.I., 414 A.2d 474, 475-76 (1980) (quoting Sun Oil Co. v. Macauley, 72 R.I. 206, 210, 49 A.2d 917, 919 (1946)).
*694 Thus, if defendant, in the exercise of the discretion vested in him by the building ordinance, had determined that plaintiff's application did not meet all of the requirements imposed by the building ordinance, then mandamus would not lie to compel him to issue the permit. Littlefield-Alger Signal Co. v. County of Nassau, 40 Misc.2d 948, 950, 244 N.Y.S.2d 579, 582 (1963). Cf. Plantations Legal Defense Services, Inc. v. O'Brien, R.I., 413 A.2d 486 (1980) (mandamus did not lie to compel District Court clerk to issue supplementary process when, in the exercise of discretion vested in him, he had determined that application for such process was deficient).
If, however, plaintiff's building-permit application conformed to all of the conditions imposed by the building ordinance, then the issuance of the requested permit became a mere ministerial duty. See Putnam v. Carroll, 13 Wash. App. 201, 205, 534 P.2d 132, 135 (1975); Bills v. Township of Grand Blanc, 59 Mich. App. 619, 623, 229 N.W.2d 871, 874 (1975); Rhodes v. Shapiro, 494 S.W.2d 248, 250 (Tex.Civ.App. 1973). See also The Bionomic Church of Rhode Island v. Gerardi, supra; Souza v. O'Hara, R.I., 395 A.2d 1060, 1062 (1978). When an application for a building permit conforms to all of the conditions imposed by the applicable law, the duty of the local building inspector to issue the requested permit is merely ministerial.
We shall now apply these principles to the case before us. The trial justice appears to have premised his decision to grant mandamus on the ground that defendant was under a clear, legal, and ministerial duty to issue the permit. This was error because the record contains no evidence from which the trial justice could conclude that plaintiff's application conformed to all of the requirements of the building ordinance. We must therefore vacate the judgment appealed from and remand the case to the Superior Court to determine, in light of the rules discussed above, if plaintiff is entitled to the relief requested in her petition for mandamus. If it is determined that plaintiff is not entitled to a writ of mandamus directing defendant to issue the disputed building permit, then the trial court may grant such appropriate relief as may enable plaintiff to avail herself of the administrative remedies now provided when an application for a building permit has been denied by a local building inspector.
In view of the foregoing, we need not consider the defendant's final contention that the plaintiff's right to the building permit was defeated by a certain zoning ordinance adopted after she had filed her petition for mandamus but prior to any hearing thereon in the Superior Court.
The defendant's appeal is sustained, the judgment appealed from is vacated, and this case is remanded to the Superior Court for proceedings not inconsistent with this opinion.
NOTES
[1]  Pursuant to the authority delegated by G.L. 1956 (1968 Reenactment) chapter 27 of title 23 (repealed 1976), the Exeter Town Council adopted the Exeter Building Ordinance on April 22, 1968.
