In 1827 , the pasha of Egypt , seeking to curry favor with the king of France , trapped a female giraffe in the Sudan and had the unsuspecting animal sent on a good-will mission to Paris , where it captured the hearts and the imagination of the public .