The party imprisoned or restrained may deny any of the facts set forth in the return or statement and may allege any other facts that may be material in the case, and the court shall proceed in a summary way to examine the causes of imprisonment or restraint and to hear the evidence that may be produced by any person interested and authorized to appear, both in support of the imprisonment or restraint and against it, and thereupon to dispose of the party as law and justice shall require.
R.I. Gen. Laws § 10-9-17