This study reports the use of multivariate tools to optimize the synthesis of a new agricultural-based biosorbent derived from sugarcane bagasse (SB) for the removal of Cd(II) and Pb(II) from aqueous solutions, as well as to optimize the process of desorption of these ions from the spent biosorbent using an acidic solution. The effects of the reaction parameters temperature (T), time (t), and the ratio of 1,2,3,4-butanetetracarboxylic acid dianhydride (BTCAD) to raw SB (w(BTCAD) w(raw SB)(-1)) on the chemical modification of raw SB with BTCAD and on the equilibrium adsorption capacity (q(e)) for Cd(II) and Pb(II) were investigated by application of a 2(3) Doehlert experimental design (DED), followed by optimization using a statistical desirability tool to produce the best adsorbent in terms of performance and cost. The best reaction condition was w(BTCAD) w(raw SB)(-1) of 4.0 g g(-1), t of 1 h, and T of 70 oC. The optimal synthesis condition resulted in a modified sugarcane bagasse (MSB) that provided q(e) values for Cd(II) and Pb(II) of 0.50 and 0.61 mmol g(-1), respectively, obtained under the following conditions: 0.311 mmol Cd(II) L-1, 0.632 mmol Pb(II) L-1, pH 5.0, 4 h, 0.2 g L-1 MSB, 130 rpm, and 25 degrees C. The desorption of Cd(II) and Pb(II) from MSB was investigated by a 2(2) DED, with optimization using the desirability tool to obtain the best desorption condition in terms of HNO3 solution concentration (CHNO3) and t. The desorption efficiencies for Cd(II) and Pb(II) were 90 +/- 4\% and 88 +/- 3\%, respectively, obtained using 0.7 mol L-1 HNO3, t of 42 min, and 1.0 g L-1 MSB-M(II) (M = Pb or Cd). Infrared spectroscopy was used to investigate the natures of the interactions involved in the adsorption of Cd(II) and Pb(II) on MSB, as well as possible changes in the chemical structure of MSB after desorption. The synthesis of MSB can be performed under mild reaction conditions (t = 1 h, T = 70 degrees C), and the solvents used can be recovered by distillation. BTCA is commercially available at moderate cost and can alternatively be obtained employing microbial succinic acid, metal-free catalysis, and modest use of petrochemical feedstocks. Furthermore, MSB can be reused, which could contribute to increasing the economic feasibility of water and wastewater treatment processes.