
967 P.2d 522 (1998)
156 Or. App. 537
STATE ex rel. Anthony L. CURRY, Appellant,
v.
S. Frank THOMPSON, Superintendent, Oregon State Penitentiary, Tamara Blair, Records Officer, Oregon State Penitentiary, Larry Daniel, Records Manager, Oregon State Penitentiary, Respondents.
97C-12411; CA A100629.
Court of Appeals of Oregon.
Submitted on Record and Briefs June 19, 1998.
Decided October 21, 1998.
*523 Anthony L. Curry filed the brief pro se.
Hardy Myers, Attorney General, Michael D. Reynolds, Solicitor General, and Jas. Adams, Assistant Attorney General, filed the brief for respondents.
Before WARREN, P.J., and EDMONDS and ARMSTRONG, JJ.
EDMONDS, Judge.
Plaintiff, an inmate in the Oregon State Penitentiary, sought a writ of mandamus granting him presentence incarceration credit against his sentences. ORS 34.105 to 34.250. He appeals from a judgment in favor of defendants that dismissed his petition with prejudice. We reverse and remand.
The following facts are taken from the trial court record on which the trial court based its dismissal. According to a Jail Certification and Authorization for Earned Early Release Credit from the Washington State Department of Corrections, plaintiff was incarcerated in Washington from August 27 to September 29, 1993, and from October 14, 1993, to May 2, 1994.[1] We address each period separately. During the first period, plaintiff was incarcerated from August 27 to September 28, 1993, relating to a Washington charge of harassment. Plaintiff was held concurrently on other charges during part of this time. The record does not expressly indicate that the other charges were Oregon charges. He remained in custody until September 29, 1993, when he was released.
During the second period, plaintiff was reincarcerated on October 14, 1993, relating to a Washington charge of promoting prostitution. On October 19, he became eligible to be released on the Washington charge pending the filing of a complaint. However, before October 19, Multnomah County requested that its warrant in case number C930633902 be executed. Thus, plaintiff remained in custody. On October 20, plaintiff signed a waiver of extradition to Oregon. On October 26, he was charged in Washington with promoting prostitution under case number 93-C-07246-1, and he was incarcerated on that charge until April 29, 1994. Plaintiff remained in custody in Washington until May 2, 1994, when he was transferred to Oregon. Finally, on September 19, 1994, plaintiff was convicted in Oregon of two counts of promoting prostitution and compelling prostitution and one count each of rape in the third degree and custodial interference in the first degree under case number C930633902.
Plaintiff sought credit for the time served in Washington and, when defendants failed to *524 credit that time, initiated the present proceeding. Defendants moved to dismiss in the trial court on the grounds that plaintiff's petition failed to state ultimate facts sufficient to constitute a claim and, in the alternative, that defendants had no obligation to award plaintiff credit. Defendants argued that plaintiff was incarcerated in Washington for crimes or conduct in Washington state, as well as the charges in Oregon, during the periods of time for which he seeks credit. It follows, they contend, that because the Washington charges were not directly related to the crimes for which sentences were later imposed in Oregon, plaintiff is not entitled to credit under ORS 137.370(4). In his response to defendants' motion to dismiss, plaintiff maintained that he was entitled to credit under ORS 137.320(2)(a) but did not contest the applicability of ORS 137.370(4). His response to defendants' motion included evidence of his unconditional release on the Washington charge of promoting prostitution, Multnomah County's request to execute its warrant, his waiver of extradition and a sheet indicating when the charges for promoting prostitution were filed in Washington. In its letter opinion, the trial court indicated that "all [plaintiff's] material and responses have been allowed, filed and considered." The court found "[d]efendant's authorities and arguments * * * persuasive."[2]
On appeal, plaintiff argues that he is entitled to 233 days of preincarceration credit against his sentences. He contends that because the Washington charges resulting in his incarceration between August 27 and September 29, 1993, were dismissed, he was being held only on the fugitive warrant from Oregon during the time. He also contends that the Washington charge of promoting prostitution and the Oregon convictions for promoting and compelling prostitution are interrelated because two witnesses testified in both trials on the charges. Furthermore, he asserts that from October 19 to October 26, 1993, he was held solely on a fugitive warrant from Oregon.
A judgment refusing to grant a writ of mandamus may be appealed as in any action. ORS 34.240. "[A] mandamus proceeding is an action at law or in the nature of a law action." Kirschbaum v. Abraham, 267 Or. 353, 355, 517 P.2d 272 (1973). We are bound by the trial court's factual findings if supported by the evidence in the record, id., and we review for errors of law, Haas v. Hathaway, 144 Or.App. 478, 480, 928 P.2d 331 (1996).
ORS 137.370 provides, in part:
"(2) Except as provided in subsections (3) and (4) of this section, when a person is sentenced to imprisonment in the custody of the Department of Corrections, for the purpose of computing the amount of sentence served the term of confinement includes only:
"(a) The time that the person is confined by any authority after the arrest for the crime for which sentence is imposed[.]"
"* * * * *
"(4) A person who is confined as the result of a sentence for a crime or conduct that is not directly related to the crime for which the sentence is imposed * * * shall not receive presentence incarceration credit for the time served in jail towards service of the term of confinement."
In Randolph v. Dept. of Corrections, 139 Or.App. 79, 85, 910 P.2d 1171, rev. den. 323 Or. 114, 913 P.2d 1384 (1996), we interpreted ORS 137.370(4) to mean that "credit for time spent in custody between arrest and commencement of sentence under ORS 137.320 is to be given only for time spent in custody as the result of the charge or conduct that gave rise to the charge for which the sentence is later imposed" (emphasis added).
Thus, the only issue in this case is whether the evidence in the record in its entirety supports the trial court's dismissal. We hold that it does not. Plaintiff argues that he is entitled to a total of 233 days of credit. From August 27 to September 28, *525 1993, plaintiff was incarcerated on a Washington state harassment charge and from October 14, 1993 to October 19, 1993, and October 26, 1993 to April 29, 1994, plaintiff was incarcerated on a Washington charge of promoting prostitution. Although plaintiff was held concurrently during parts of those periods for Oregon and Washington charges, his incarceration was not solely the result of the Oregon charges or the conduct that gave rise to those charges. Plaintiff would have remained in custody even if there had been no Oregon charges against him. The fact that two witnesses testified in the Oregon and Washington trials for promoting prostitution does not mean that the charges were the same or that the same conduct gave rise to both charges. Because plaintiff was not being held solely as a result of the charge or the conduct that gave rise to the charge for which he was later sentenced, he is not entitled to credit for those periods.[3]
From October 19, 1993, until October 26, 1993, plaintiff was being held solely on the warrant from Oregon. Thereafter, plaintiff was held from April 29 to May 2, 1994, solely on Oregon case number C930633902. Thus, he is entitled to credit for those periods because his detention was the result of the Oregon charges of which he was eventually convicted. The trial court erred in dismissing plaintiff's petition for a writ of mandamus with regard to credit for those periods. Otherwise, the trial court's ruling was correct.
Reversed and remanded with instructions to issue peremptory writ of mandamus in accordance with this opinion.
NOTES
[1]  According to a Statement of Imprisonment from Multnomah County, plaintiff was incarcerated in the State of Washington from August 27 to September 29, 1993, from October 15 to October 16, 1993, and from October 18, 1993, to May 2, 1994, on Multnomah County case number C930633902 for a total of 233 days. A notation on the statement indicates that Multnomah County verified that plaintiff spent that time incarcerated in Washington, but it also indicates that "W[ashington] must certify this time case specific to O[regon] charges."
[2]  ORS 137.370(4) was not enacted until 1995. Plaintiff was convicted in 1994. However, he does not argue that the current statute is inapplicable to him. Instead, he refers to the statute in his brief and argues that the crimes of promoting prostitution in Oregon and Washington were interrelated. For purposes of this opinion, we accept his implicit concession that ORS 137.370(4) applies.
[3]  The same reasoning applies to the day of September 29, 1993. The record is unclear about whether plaintiff was being held pursuant to the Oregon charge on that day.
