Appeal from the United States District Court for the Northern District of New York (Glenn T. Suddaby, J.). Petitioner-Appellant Daniel Lugo, proceeding pro se, appeals from the district court’s denial of his petition for a writ of habeas corpus pursuant to 28 U.S.C. § 2241, in which he asserted that the Bureau of Prisons (the “BOP”) incorrectly calculated his ten-year sentence. While serving a state sentence, Lugo was indicted on federal charges and a writ of habeas corpus ad prosequendum was issued, calling for his transfer to federal authorities for arraignment on a certain date. However, that date passed before Lugo was transferred, and he contends that his transfer was therefore not pursuant to the writ but rather was an outright transfer by the State to federal custody, causing all of the ensuing time he spent in custody to be attributable to his eventual federal sentence. For the reasons that follow, we hold that even if there was a technical deficiency in connection with the execution of the writ of habeas corpus ad prosequendum that was issued, that deficiency did not invalidate the otherwise valid writ, and we affirm.
BACKGROUND
In 2000, Lugo was sentenced to six to twelve years’ imprisonment following his New York State convictions for criminal possession of a controlled substance, under N.Y. Penal Law § 220.16, and conspiracy, under N.Y. Penal Law § 105.15. He began serving his sentence in March 2000. While serving his state sentence, Lugo was indicted on federal charges and temporarily transferred to federal custody after the issuance of a writ of habeas corpus ad prosequendum. The writ directed that he be produced on October 10, 2001 for arraignment on the federal charges and that, thereafter, United States Marshals “main-taint Lugo] within the jurisdiction of [the Eastern District of New York] pending the satisfaction of [the] writ.” Lugo v. Hudson, No. 9:13-cv-00753(GTS), slip op. at 3 (N.D.N.Y. June 16, 2014) (internal quotation marks omitted). The court’s relevant docket entry did not indicate the issuance of the writ but merely stated that a sealed document had been filed. For reasons not apparent on the record, Lugo was not transferred to federal custody until October 18, 2001, and was arraigned on October 19, 2001. Lugo remained in federal *854custody through his federal trial and sentencing.
Lugo was convicted in federal court in October 2002 and sentenced to ten years’ imprisonment, to run consecutively to his state court sentence. Lugo was returned to a state correctional facility in November 2002. Pursuant to the writ, the time that Lugo spent in custody for his federal prosecution was credited towards his ongoing New York State sentence. That sentence ended in October 2008 when Lugo was released on parole, at which point he was transferred into the custody of the U.S. Marshals and began serving his ten-year federal sentence.
The BOP calculated Lugo’s federal release date to be September 3, 2017. In June 2013, Lugo filed a petition pursuant to 28 U.S.C. § 2241 in district court, asserting that the BOP had incorrectly calculated his sentence because no valid, writ had been issued. Lugo argued, inter alia, that the writ was invalid because it required that he be produced in federal court for arraignment on October 10, 2001, and that when he was not so produced, there was no valid writ ad prosequendum that required him to be produced for arraignment at a later date. He contended that without a valid writ, his ten-year federal sentence began to run on the day it was imposed in 2002 (and had therefore expired by the time he filed his § 2241 petition in 2013) and that any time spent in federal custody during his prosecution should have been credited towards his federal sentence.
The district court denied the petition, ruling that the writ was valid, that New York State retained primary custody over Lugo during his federal prosecution, and that time credited towards his staté sentence could not be counted for both the state and federal sentences. Lugo v. Hudson, No. 9:13-cv-00753(GTS), slip op. at 10-12 (N.D.N.Y. June 16, 2014). The district court determined that the record contradicted Lugo’s arguments that the writ was invalid: the indictment number on the writ matched that of the indictment for which Lugo was convicted, and even though the writ was captioned “Application for Writ of Habeas Corpus,” the body of the writ specified that it was a writ ad prosequendum. See id. at 10-11. In determining that the writ was valid, the court did not discuss the fact that Lugo’s arraignment date differed from that listed on the writ.
DISCUSSION
We review a district court’s denial of a petition for a writ of habeas corpus brought pursuant to § 2241 de novo and review any factual findings for clear error. See, e.g., Sacirbey v. Guccione, 589 F.3d 52, 63 (2d Cir.2009); Sash v. Zenk, 428 F.3d 132, 134 (2d Cir.2005). On appeal, Lugo argues that the writ was invalid because (1) it was not executed on the date specified in the writ for his arraignment; and (2) it was originally sealed on the district court’s docket sheet. Lugo argues that because the writ was invalid, his federal sentence began on the day it was imposed and that the time spent in custody during his prosecution should have counted towards his federal sentence. Additionally, Lugo argues that his federal sentence began in 2002, that the U.S. Marshals improperly transferred him back to state custody, and that he has now completed his ten-year federal sentence.
A writ ad prosequendum orders the production of a prisoner in court for the purpose of standing trial. See 28 U.S.C. § 2241(c)(5); United States v. Mauro, 436 U.S. 340, 357-58, 98 S.Ct. 1834, 56 L.Ed.2d 329 (1978). If a prisoner is serving a state sentence when he is produced for a federal prosecution, the writ temporarily transfers *855him to federal custody for prosecution but the state retains primary custody for the purpose of calculating his state sentence. See United States v. Fermin, 252 F.3d 102, 108 n. 10 (2d Cir.2001).
This Court has not yet determined whether technical errors invalidate a writ ad prosequendum. The Seventh Circuit, however, has concluded that errors of form or technicality are not fatal so long as the writ “expressly indicates that it was issued for a proper purpose.” United States v. Larkin, 978 F.2d. 964, 968 (7th Cir.1992). Larkin involved a writ of habeas corpus ad testificandum that was mislabeled a writ of habeas corpus ad prosequendum.1 However, the court held that the error was haxmless because the writ made clear that it was issued to compel the defendant’s presence to testify before a grand juiy. See id. The Tenth Circuit has similarly held that an improperly labeled writ is not invalid so long as the writ accurately describes the purpose for which it was issued. See Gilmore v. United States, 129 F.2d 199, 202 (10th Cir.1942). We now adopt a similar rale.
Here, the writ correctly announced that its purpose was to produce Lugo for arraignment in federal court and “thereafter to maintain[ him] within the jxmadiction of the [Eastern District of New York] pending the satisfaction of [the] writ or the [further] orders of the Court.”' Lugo v. Hudson, No. 9:13-cv-00753(GTS), slip op. at 3 (N.D.N.Y. June 16, 2014). The fact that the State’s transfer of Lugo to federal custody missed the October 10 date specified for his arraignment did not mean that the transfer was not pursuant to the writ. He was transferred shortly after that date for the purpose of arraignment, and he was arraigned on the day after his transfer. The government’s failxire to meet the arraignment date specified in the writ did not invalidate the writ itself.
Additionally, Lugo argues that the writ was sealed “because of its invalidity” and that, as a result, no proper writ appears on the docket sheet. Appellant Br. 20. Because this issue is raised for the first time on appeal, we need not consider it. See Singleton v. Wulff, 428 U.S. 106, 120, 96 S.Ct. 2868, 49 L.Ed.2d 826 (1976); see also Virgilio v. City of New York, 407 F.3d 105, 116 (2d Cir.2005). In any event, the argument is without merit because Lugo provides no support for his allegation that the sealed writ was invalid or that its sealing was somehow connected to its validity.
Lugo was transferred to federal custody pursuant to a valid writ ad prosequendum, which operates to allow a governmental entity to “borrow” a prisoner from his primary custodian. See, e.g., Thomas v. Whalen, 962 F.2d 358, 360-61 & n. 3 (4th Cir.1992). For the pxirpose of calculating his state incarceration, the State treated Lugo as remaining within state custody during his federal prosecution; thus, that detention period was properly credited towards his state sentence. See 18 U.S.C. § 3585(a) (a federal prisoner’s sentence “commences on the date the defendant is received in custody awaiting transportation to, or arrives voluntarily to commence service of sentence at, the official detention facility at which the. sentence . is to be served”); Fermin, 252 F.3d at 108 n. 10 (“a defendant held at a federal detention facility is not ‘in custody5 for the purposes of § 3585(a) when he is produced through a writ of habeas corpus ad prosequendum”). When Lugo was released from state custody in 2008 and delivered to federal officials, he then began serving his federal sentence. Thus, the BOP did not *856incorrectly calculate his sentence. See United States v. Labeille-Soto, 163 F.3d 93, 99 (2d Cir.1998) (a “defendant has no right to credit on his federal sentence for time that has been credited against his prior state sentence”).
CONCLUSION
We have considered all of Lugo’s arguments on this appeal and find them to be without merit. Accordingly, we AFFIRM the judgment of the district court.