Báez next supported the idea of having the Dominican Republic be taken over by Spain. He went into exile in Spain and led a luxurious life there. The Spanish agreed to occupy the Dominican Republic in 1861, but by 1865 they had abandoned it (see Dominican Restoration War). Báez then returned to the Dominican Republic and became president again until he was deposed in another coup in May 1866. He then served his longest term as president, from 1868 until 1874, during which time he again attempted to have the United States annex the Dominican Republic. This time he was almost successful, as he convinced American President Ulysses S. Grant to send warships to the Dominican Republic, and drew up an annexation treaty which reached the United States Senate floor. The treaty, however, was not ratified in the US Senate, as there was widespread opposition to absorbing a nation with so many black and mixed race inhabitants. The treaty became an embarrassment for Grant.