
66 Wis.2d 630 (1975)
225 N.W.2d 493
HALL, Plaintiff in error,
v.
STATE, Defendant in error.[*]
No. State 166.
Supreme Court of Wisconsin.
Decided February 4, 1975.
*631 For the plaintiff in error: Howard B. Eisenberg, state public defender.
For the defendant in error: Robert W. Warren, attorney general, James H. McDermott, assistant attorney general, and E. Michael McCann, district attorney, Milwaukee county.
DAY, J.
This case raises the question as to when a challenge to a sentence must be made by appeal or writ of error which alleges the failure of the trial court to consider preconviction incarceration time spent in jail because of financial inability to post bail.
Plaintiff in error Charles Ray Hall was convicted under secs. 943.32 (1) (b), 943.32 (2), and 939.05, Stats., of armed robbery as a party to a crime upon his plea of guilty on February 15, 1971. He received a sentence *632 of fifteen years in prison, one half of the maximum. On June 2, 1974, he moved that his sentence be modified to give him credit for time spent in the Milwaukee county jail prior to sentencing. In support of the motion, he alleged he was arrested on June 22, 1970; that he was unable to post bond; and that he remained incarcerated until his trial date. This was a period of approximately eight months. Upon receiving this pro se motion, the trial judge wrote plaintiff in error a letter under date of June 5, 1974, stating:
"I have checked the Court transcript and the Court file and after reviewing the same I do not see fit to alter the sentence imposed by this Court on February 15th, 1971."
This letter was treated as an order and a writ of error was issued by this court to review it. The state public defender, representing Mr. Hall, has moved that the order denying the motion for reduction of sentence be vacated and the cause be remanded for reconsideration in light of our decision in Byrd v. State (1974), 65 Wis. 2d 415, 222 N. W. 2d 696. The state has opposed this motion on the ground the Byrd decision ought to be prospective only in its application.
We announced two rules in Byrd with regard to consideration of preconviction incarceration. The first was that:
". . . a defendant must be given credit for time spent in custody prior to conviction to the extent such time added to the sentence imposed exceeds the maximum sentence permitted under the statute for such offense, provided such time spent in custody was a result of the criminal charge for which a prison or jail sentence is imposed or as a result of the conduct on which such charge is based, provided further that such custody was the result of the defendant's financial inability to post bail. . . .
". . . where the statutory maximum sentence is given the failure to give credit for preconviction time spent in *633 custody violates the Equal Protection Clause of the fourteenth amendment." 65 Wis. 2d at 424.
The second rule is that it is mandatory for the trial judge to consider pretrial incarceration in determining any sentence to be imposed. Byrd does not make mandatory a credit under such circumstances, nor does it make the failure to take pretrial incarceration into account a denial of equal protection, in the absence of a showing that the maximum term prescribed by law for the offense has been exceeded. Rather, the second Byrd rule constitutes a modification of our holding in State v. Tew (1972), 54 Wis. 2d 361, 195 N. W. 2d 615, that the length of pretrial detention is merely a "proper" factor to consider in exercising judicial discretion in sentencing. In Byrd we held that:
". . . in imposing any sentence, the court must, in exercising its discretion, take into consideration, in determining the length of sentence to be imposed, the time the defendant has spent in preconviction custody. Such consideration must be given even though the time spent in custody when added to the sentence would be less than the maximum. This requirement modifies Tew by making such consideration mandatory rather than permissive." 65 Wis. 2d at 425, 426.
Under Byrd the trial judge is required to ascertain the fact of pretrial incarceration and the circumstances surrounding it before pronouncing sentence.
A violation of the first rule of Byrd may be raised under sec. 974.06, Stats., at any time while the sentence is being served. This is because such sentence denies a constitutional right of the accused and is greater than the maximum imprisonment prescribed by law for the offense, both of which are grounds for a motion for postconviction relief under sec. 974.06. A violation of the second rule of Byrd is not ground for a sec. 974.06 motion, because where there is no maximum sentence problem the failure of the trial court to take into account *634 pretrial detention because of indigency is an abuse of discretion rather than a denial of constitutional right. Such an abuse of discretion is challenged by a motion for modification of sentence, which was authorized in Hayes v. State (1970), 46 Wis. 2d 93, 175 N. W. 2d 625. Hayes requires that such motion be made within ninety days from the date of sentencing. In this case the motion was made more than three years after sentencing. Therefore, the motion was too late and was properly denied by the trial court.
The motion to vacate the order of the trial court and to remand for reconsideration of the defendant's motion is denied and the order is affirmed.
By the Court.Order affirmed.
NOTES
[*]  Motion for reconsideration denied April 28, 1975.
